Skip to content

Commit 107c161

Browse files
committed
Fix Applicability
1 parent a435739 commit 107c161

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

clippy_lints/src/redundant_clone.rs

+2-2
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

+1-1
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

+1-1
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)