Skip to content

Commit 5ebb389

Browse files
waywardmonkeysalerque
authored andcommitted
refactor: Fix match related warnings
1 parent 020e6a2 commit 5ebb389

File tree

3 files changed

+9
-21
lines changed

3 files changed

+9
-21
lines changed

fluent-bundle/benches/resolver.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,10 @@ fn get_args(name: &str) -> Option<FluentArgs> {
5858
}
5959

6060
fn add_functions<R>(name: &'static str, bundle: &mut FluentBundle<R>) {
61-
match name {
62-
"preferences" => {
63-
bundle
64-
.add_function("PLATFORM", |_args, _named_args| "linux".into())
65-
.expect("Failed to add a function to the bundle.");
66-
}
67-
_ => {}
61+
if name == "preferences" {
62+
bundle
63+
.add_function("PLATFORM", |_args, _named_args| "linux".into())
64+
.expect("Failed to add a function to the bundle.");
6865
}
6966
}
7067

fluent-bundle/benches/resolver_iai.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,10 @@ use unic_langid::{langid, LanguageIdentifier};
55
const LANG_EN: LanguageIdentifier = langid!("en");
66

77
fn add_functions<R>(name: &'static str, bundle: &mut FluentBundle<R>) {
8-
match name {
9-
"preferences" => {
10-
bundle
11-
.add_function("PLATFORM", |_args, _named_args| "linux".into())
12-
.expect("Failed to add a function to the bundle.");
13-
}
14-
_ => {}
8+
if name == "preferences" {
9+
bundle
10+
.add_function("PLATFORM", |_args, _named_args| "linux".into())
11+
.expect("Failed to add a function to the bundle.");
1512
}
1613
}
1714

fluent-bundle/tests/bundle.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,8 @@ fn borrowed_plain_message() {
5555
bundle.format_pattern(value, None, &mut errors)
5656
};
5757

58-
fn is_borrowed(cow: Cow<'_, str>) -> bool {
59-
match cow {
60-
Cow::Borrowed(_) => true,
61-
_ => false,
62-
}
63-
}
6458
assert_eq!(formatted_pattern, "Value");
65-
assert!(is_borrowed(formatted_pattern));
59+
assert!(matches!(formatted_pattern, Cow::Borrowed(_)));
6660
}
6761

6862
#[test]

0 commit comments

Comments
 (0)