Skip to content

Commit

Permalink
address clippy lints found in new beta clippy 1.59 (exercism#1426)
Browse files Browse the repository at this point in the history
* address clippy lints found in new beta clippy 1.59

* remove unnecessary mutability

* remove redundant tests
  • Loading branch information
coriolinus authored Jan 14, 2022
1 parent ba227ef commit 163ced1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
6 changes: 3 additions & 3 deletions exercises/practice/decimal/.meta/example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ impl Decimal {
/// Add precision to the less-precise value until precisions match
///
/// Precision, in this case, is defined as the decimal index.
fn equalize_precision(mut one: &mut Decimal, mut two: &mut Decimal) {
fn equalize_precision(one: &mut Decimal, two: &mut Decimal) {
fn expand(lower_precision: &mut Decimal, higher_precision: &Decimal) {
let precision_difference =
(higher_precision.decimal_index - lower_precision.decimal_index) as usize;
Expand All @@ -71,8 +71,8 @@ impl Decimal {
}
match one.decimal_index.cmp(&two.decimal_index) {
std::cmp::Ordering::Equal => {}
std::cmp::Ordering::Less => expand(&mut one, &two),
std::cmp::Ordering::Greater => expand(&mut two, &one),
std::cmp::Ordering::Less => expand(one, two),
std::cmp::Ordering::Greater => expand(two, one),
}
assert_eq!(one.decimal_index, two.decimal_index);
}
Expand Down
2 changes: 0 additions & 2 deletions exercises/practice/decimal/tests/decimal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ fn test_ne() {
fn test_gt() {
for slice_2 in BIGS.windows(2) {
assert!(decimal(slice_2[1]) > decimal(slice_2[0]));
assert!(!(decimal(slice_2[0]) > decimal(slice_2[1])));
}
}

Expand All @@ -45,7 +44,6 @@ fn test_gt() {
fn test_lt() {
for slice_2 in BIGS.windows(2) {
assert!(decimal(slice_2[0]) < decimal(slice_2[1]));
assert!(!(decimal(slice_2[1]) < decimal(slice_2[0])));
}
}

Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/macros/tests/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ mod simple_trybuild {
file_path.into_os_string()
);

let test_name = file_name.replace(".", "-");
let test_name = file_name.replace('.', "-");
let macros_dir = ["..", "..", "target", "tests", "macros"]
.iter()
.collect::<PathBuf>();
Expand Down

0 comments on commit 163ced1

Please sign in to comment.