Skip to content

Commit f1abd85

Browse files
committed
Add missing Clippy allows to solutions
1 parent 423b50b commit f1abd85

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

solutions/09_strings/strings4.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,11 @@ fn main() {
1818
// Here, both answers work.
1919
// `.into()` converts a type into an expected type.
2020
// If it is called where `String` is expected, it will convert `&str` to `String`.
21-
// But if is called where `&str` is expected, then `&str` is kept `&str` since no
22-
// conversion is needed.
2321
string("nice weather".into());
22+
// But if it is called where `&str` is expected, then `&str` is kept `&str` since no conversion is needed.
23+
// If you remove the `#[allow(…)]` line, then Clippy will tell you to remove `.into()` below since it is a useless conversion.
24+
#[allow(clippy::useless_conversion)]
2425
string_slice("nice weather".into());
25-
// ^^^^^^^ the compiler recommends removing the `.into()`
26-
// call because it is a useless conversion.
2726

2827
string(format!("Interpolation {}", "Station"));
2928

solutions/18_iterators/iterators4.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ fn factorial_fold(num: u64) -> u64 {
2525
// -> 1 * 2 is calculated, then the result 2 is multiplied by
2626
// the second element 3 so the result 6 is returned.
2727
// And so on…
28+
#[allow(clippy::unnecessary_fold)]
2829
(2..=num).fold(1, |acc, x| acc * x)
2930
}
3031

0 commit comments

Comments
 (0)