Skip to content

Commit a4130e1

Browse files
committed
Auto merge of rust-lang#8355 - Jarcho:explicit_auto_deref_2, r=flip1995
Add lint `explicit_auto_deref` take 2 fixes: rust-lang#234 fixes: rust-lang#8367 fixes: rust-lang#8380 Still things to do: * ~~This currently only lints `&*<expr>` when it doesn't trigger `needless_borrow`.~~ * ~~This requires a borrow after a deref to trigger. So `*<expr>` changing `&&T` to `&T` won't be caught.~~ * The `deref` and `deref_mut` trait methods aren't linted. * Neither ~~field accesses~~, nor method receivers are linted. * ~~This probably shouldn't lint reborrowing.~~ * Full slicing to deref should probably be handled here as well. e.g. `&vec[..]` when just `&vec` would do changelog: new lint `explicit_auto_deref`
2 parents 23c6765 + 5e2a2d3 commit a4130e1

33 files changed

+1560
-273
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -3400,6 +3400,7 @@ Released 2018-09-13
34003400
[`expect_fun_call`]: https://rust-lang.github.io/rust-clippy/master/index.html#expect_fun_call
34013401
[`expect_used`]: https://rust-lang.github.io/rust-clippy/master/index.html#expect_used
34023402
[`expl_impl_clone_on_copy`]: https://rust-lang.github.io/rust-clippy/master/index.html#expl_impl_clone_on_copy
3403+
[`explicit_auto_deref`]: https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref
34033404
[`explicit_counter_loop`]: https://rust-lang.github.io/rust-clippy/master/index.html#explicit_counter_loop
34043405
[`explicit_deref_methods`]: https://rust-lang.github.io/rust-clippy/master/index.html#explicit_deref_methods
34053406
[`explicit_into_iter_loop`]: https://rust-lang.github.io/rust-clippy/master/index.html#explicit_into_iter_loop

clippy_dev/src/update_lints.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ fn remove_lint_declaration(name: &str, path: &Path, lints: &mut Vec<Lint>) -> io
413413
.find("declare_lint_pass!")
414414
.unwrap_or_else(|| panic!("failed to find `impl_lint_pass`"))
415415
});
416-
let mut impl_lint_pass_end = (&content[impl_lint_pass_start..])
416+
let mut impl_lint_pass_end = content[impl_lint_pass_start..]
417417
.find(']')
418418
.expect("failed to find `impl_lint_pass` terminator");
419419

0 commit comments

Comments
 (0)