File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -18,12 +18,11 @@ fn main() {
18
18
// Here, both answers work.
19
19
// `.into()` converts a type into an expected type.
20
20
// 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.
23
21
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) ]
24
25
string_slice ( "nice weather" . into ( ) ) ;
25
- // ^^^^^^^ the compiler recommends removing the `.into()`
26
- // call because it is a useless conversion.
27
26
28
27
string ( format ! ( "Interpolation {}" , "Station" ) ) ;
29
28
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ fn factorial_fold(num: u64) -> u64 {
25
25
// -> 1 * 2 is calculated, then the result 2 is multiplied by
26
26
// the second element 3 so the result 6 is returned.
27
27
// And so on…
28
+ #[ allow( clippy:: unnecessary_fold) ]
28
29
( 2 ..=num) . fold ( 1 , |acc, x| acc * x)
29
30
}
30
31
You can’t perform that action at this time.
0 commit comments