rust-clippy
rust-clippy copied to clipboard
A bunch of lints to catch common mistakes and improve your Rust code. Book: https://doc.rust-lang.org/clippy/
This PR closes https://github.com/rust-lang/rust-clippy/issues/11103. This is my first PR creating a new lint (and the second attempt of creating this PR, the first one I was not able to continue...
### Summary ```rust #![deny(clippy::borrow_interior_mutable_const)] use std::cell::UnsafeCell; const ATOMIC_TUPLE: (Vec, u8) = (Vec::new(), 42); fn main() { let _x = &ATOMIC_TUPLE.0; } ``` reports: ``` error: internal compiler error: /home/ben/rust/compiler/rustc_middle/src/ty/consts/valtree.rs:55:18: expected...
### Summary This happens when we have a function that expects `Arc`. It generates a warning on the calls to the function (more specifically when the `Arc`s are constructed), but...
### What it does Lints cases where a `use`, item declaration, or local binding shadows an item in the Rust prelude. In the case of a `use`, it suggests instead...
Short overview of the functional changes: * `possible_missing_comma`: * Actually check that the formatting looks like a unary op. * Also lint in tuples, parenthesis and argument lists. * Check...
### What it does Improve the code to be more concise ### Advantage - Less and cleaner ### Drawbacks _No response_ ### Example ```rust fn foo() { let x =...
### What it does Constants can be shadowed when in different scopes. This can lead to non-obvious situations, where a later declared constant already shadows the previous constant, e.g. the...
changelog: [`explicit_auto_deref`] Fix some false-positive cases Partially fix OP of #9841 Fix #12969
### Description cargo currently rebuilds all dependants of a crate instead of just relinking. when only changing the implementation of a lint, this is unnecessary. using dylib or cdylib should...
The `assigning_clones` lint had a special case for producing a bit nicer code for mutable references: ```rust fn clone_function_lhs_mut_ref(mut_thing: &mut HasCloneFrom, ref_thing: &HasCloneFrom) { *mut_thing = Clone::clone(ref_thing); } //v fn...