Skip to content

Commit b834dbb

Browse files
committed
Auto merge of #3984 - phansch:bytecount_sugg, r=flip1995
Change naive_bytecount applicability to MaybeIncorrect We can't use `MachineApplicable` here as applying the fix will cause another error because `bytecount` would first have to be added to the Cargo.toml. Example: ``` error: You appear to be counting bytes the naive way --> $DIR/bytecount.rs:5:13 | LL | let _ = x.iter().filter(|&&a| a == 0).count(); // naive byte count | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Consider using the bytecount crate: `bytecount::count(x, 0)` ``` Just replacing it with the suggestion is not enough. cc #3630
2 parents 58e1213 + 01ea9bd commit b834dbb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

clippy_lints/src/bytecount.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ByteCount {
7575
} else {
7676
&filter_args[0]
7777
};
78-
let mut applicability = Applicability::MachineApplicable;
78+
let mut applicability = Applicability::MaybeIncorrect;
7979
span_lint_and_sugg(
8080
cx,
8181
NAIVE_BYTECOUNT,

0 commit comments

Comments
 (0)