Skip to content

Commit 13e409b

Browse files
committed
refactor: Apply clippy fixes with more idiomatic code patterns
1 parent f2033ce commit 13e409b

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

fluent-bundle/examples/functions.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ fn main() {
3535
// Test for a function that accepts named arguments
3636
bundle
3737
.add_function("BASE_OWNERSHIP", |_args, named_args| {
38-
return match named_args.get("ownership") {
38+
match named_args.get("ownership") {
3939
Some(FluentValue::String(ref string)) => {
4040
format!("All your base belong to {}", string).into()
4141
}
4242
_ => FluentValue::Error,
43-
};
43+
}
4444
})
4545
.expect("Failed to add a function to the bundle.");
4646

fluent-bundle/src/types/number.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,7 @@ impl FluentNumber {
150150
if let Some(minfd) = self.options.minimum_fraction_digits {
151151
if let Some(pos) = val.find('.') {
152152
let frac_num = val.len() - pos - 1;
153-
let missing = if frac_num > minfd {
154-
0
155-
} else {
156-
minfd - frac_num
157-
};
153+
let missing = minfd.saturating_sub(frac_num);
158154
val = format!("{}{}", val, "0".repeat(missing));
159155
} else {
160156
val = format!("{}.{}", val, "0".repeat(minfd));

0 commit comments

Comments
 (0)