Skip to content

Commit ea289a3

Browse files
committed
Fix Applicability
1 parent 700e101 commit ea289a3

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

clippy_lints/src/redundant_clone.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for RedundantClone {
211211
let mut app = Applicability::MaybeIncorrect;
212212
let mut call_snip = &snip[dot + 1..];
213213
if call_snip.ends_with("()") {
214-
call_snip = &call_snip[..call_snip.len()-2];
215-
if call_snip.as_bytes().iter().all(u8::is_ascii_alphabetic) {
214+
call_snip = call_snip[..call_snip.len()-2].trim();
215+
if call_snip.as_bytes().iter().all(|b| b.is_ascii_alphabetic() || *b == b'_') {
216216
app = Applicability::MachineApplicable;
217217
}
218218
}

tests/ui/redundant_clone.fixed

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// run-rustfix
2-
2+
// rustfix-only-machine-applicable
33
use std::ffi::OsString;
44
use std::path::Path;
55

tests/ui/redundant_clone.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// run-rustfix
2-
2+
// rustfix-only-machine-applicable
33
use std::ffi::OsString;
44
use std::path::Path;
55

0 commit comments

Comments
 (0)