-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Clippy #87152
Merged
Merged
Update Clippy #87152
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Update Clippy Biweekly Clippy Update r? `@Manishearth`
Downgrade nonstandard_macro_braces to nursery Due to the large number of crates impacted by rust-lang#7422, I don't think this lint can be enabled by default right now until the false positive is fixed. --- changelog: remove [`nonstandard_macro_braces`] from default set of enabled lints
Add new lint: `rc_mutex` changelog: Add new lint `rc_mutex`. It lints on `Rc<Mutex<T>>`. `Rc<Mutex<T>>` should be corrected to `Rc<RefCell<T>>`
fix doc_markdown false positive fixes rust-lang#7421 changelog: don't lint unbalanced tick marks in code blocks
Fix use_self ICE changelog: Fix ICE rust-lang#7423 r? `@flip1995`
Fix emitting in nested (proc_)macros for nonstandard_macro_braces lint fixes rust-lang#7422 changelog: fixes false positives in [`nonstandard_macro_braces`]
… r=giraffate Add new lint: `strlen_on_c_strings` ~~This is WIP, linting in case of `CString` has been added, but for `CStr`, its diagnostic item needs to be available for clippy. [PR that adds diagnostic item for CStr on rust repo](rust-lang#85439 Ready for the review. Please take a look. fixes rust-lang#7145 changelog: Add new lint: `strlen_on_c_strings`, that lints on `libc::strlen(some_cstring.as_ptr())`
Fix false-positive `assert` in `panic` This PR fixes a false-positive in `clippy::panic` when using the `assert` macro with its optional message parameter. Fixes: rust-lang#7433 changelog: `panic_unimplemented.rs`: added condition to exclude `assert` macro, similar to `debug_assert` changelog: `panicking_macros.rs`: relevant tests to check for `assert` usage.
Rollup of 8 pull requests Successful merges: - rust-lang#80918 (Add Integer::log variants) - rust-lang#86717 (Rename some Rust 2021 lints to better names ) - rust-lang#86819 (Clean up rustdoc IDs) - rust-lang#86880 (Test ManuallyDrop::clone_from.) - rust-lang#86906 (Replace deprecated compare_and_swap and fix typo in core::sync::atomic::{fence, compiler_fence} docs) - rust-lang#86907 (Migrate `cpu-usage-over-time.py` to Python 3) - rust-lang#86916 (rewrote documentation for thread::yield_now()) - rust-lang#86919 (Update books) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Fix internal `default_hash_types` lint to use resolved path I run into false positives now and then (mostly in Clippy) when I want to name some util after HashMap.
fix 5707 changelog: ``[`redundant_clone`]``, fix rust-lang#5707 # Root problem of rust-lang#5707 : ``` &2:&mut HashMap = &mut _4; &3:&str = & _5; _1 = HashMap::insert(move _2,move _3, _); ``` generate PossibleBorrower(_2,_1) and PossibleBorrower(_3,_1). However, it misses PossibleBorrower(_3,_2). # My solution to rust-lang#5707 : When meet a function call, we should: 1. build PossibleBorrower between borrow parameters and return value (currently) 2. build PossibleBorrower between immutable borrow parameters and mutable borrow parameters (*add*) 3. build PossibleBorrower inside mutable borrow parameters (*add*) For example: ``` _2: &mut _22; _3: &mut _; _4: & _; _5: & _; _1 = call(move _2, move _3, move _4, move _5); ``` we need to build 1. return value with parameter(current implementataion) PossibleBorrower(_2,_1) PossibleBorrower(_3,_1) PossibleBorrower(_4,_1) PossibleBorrower(_5,_1) 2. between mutable borrow and immutable borrow PossibleBorrower(_4,_2) PossibleBorrower(_5,_2) PossibleBorrower(_4,_3) PossibleBorrower(_5,_3) 3. between mutable borrow and mutable borrow PossibleBorrower(_3,_2) PossibleBorrower(_2,_3) But that's not enough. Modification to _2 actually apply to _22. So I write a `PossibleBorrowed` visitor, which tracks (borrower => possible borrowed) relation. For example (_2 => _22). However, a lot of problems exist here. ## Known Problems: 1. not sure all `&mut`'s origin are collected. I'm not sure how to deal with `&mut` when meet a function call, so I didn't do it currently. Also, my implement is not flow sensitive, so it's not accurate. ``` foo(_2:&mut _, _3: &_) ``` This pr doesn't count _3 as origin of _2. 2. introduce false negative `foo(_2, _3)` will emit PossibleBorrower(_3,_2) in this pr, but _3 and _2 may not have relation. Clippy may feel that _3 is still in use because of _2, but actually, _3 is on longer needed and can be moved. ## Insight The key problem is determine where every `&mut` come from accurately. I think Polonius is an elegant solution to it. Polonius is flow sensitive and accurate. But I'm uncertain about whether we can import Polonius in rust-clippy currently. This pr actually is part of Polonius' functionality, I think. # TODO 1. `cargo test` can't pass yet due to similar variable name
…1995 suggest `&mut` for redundant FnMut closures fixes rust-lang#6903 changelog: suggest `&mut` for redundant FnMut closures
And added `branches_sharing_code` PF note to lint doc for `rust-clippy#7452`
…se-expr-fp, r=camsteffen FP fix and documentation for `branches_sharing_code` lint Closes rust-lang/rust-clippy#7369 Related rust-lang/rust-clippy#7452 I'm still thinking about the best way to fix this. I could simply add another visitor to ensure that the moved expressions don't modify values being used in the condition, but I'm not totally happy with this due to the complexity. I therefore only documented it for now changelog: [`branches_sharing_code`] fixed false positive where block expressions would sometimes be ignored.
…xFrednet,flip1995 add Arc to `redundant_allocation` fixes rust-lang#7303 changelog: add Arc to `redundant_allocation`
Rustup r? `@ghost` changelog: none
Some changes occurred in src/tools/clippy. cc @rust-lang/clippy |
rust-highfive
added
the
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
label
Jul 15, 2021
@bors r+ |
📌 Commit e7bc411 has been approved by |
bors
added
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
and removed
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
labels
Jul 15, 2021
@bors p=1 |
☀️ Test successful - checks-actions |
This was referenced Jul 15, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
merged-by-bors
This PR was explicitly merged by bors.
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
r? @Manishearth