forked from rust-lang/rust-clippy
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Honor avoid-breaking-exported-api in needless_pass_by_ref_mut
Until now, the lint only emitted a warning, when breaking public API. Now it doesn't lint at all when the config value is not set to `false`, bringing it in line with the other lints using this config value. Also ensures that this config value is documented in the lint.
- Loading branch information
Showing
8 changed files
with
62 additions
and
31 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
avoid-breaking-exported-api = false |
9 changes: 9 additions & 0 deletions
9
tests/ui-toml/needless_pass_by_ref_mut/needless_pass_by_ref_mut.fixed
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#![warn(clippy::needless_pass_by_ref_mut)] | ||
|
||
// Should warn | ||
pub fn pub_foo(s: &Vec<u32>, b: &u32, x: &mut u32) { | ||
//~^ ERROR: this argument is a mutable reference, but not used mutably | ||
*x += *b + s.len() as u32; | ||
} | ||
|
||
fn main() {} |
9 changes: 9 additions & 0 deletions
9
tests/ui-toml/needless_pass_by_ref_mut/needless_pass_by_ref_mut.rs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#![warn(clippy::needless_pass_by_ref_mut)] | ||
|
||
// Should warn | ||
pub fn pub_foo(s: &mut Vec<u32>, b: &u32, x: &mut u32) { | ||
//~^ ERROR: this argument is a mutable reference, but not used mutably | ||
*x += *b + s.len() as u32; | ||
} | ||
|
||
fn main() {} |
12 changes: 12 additions & 0 deletions
12
tests/ui-toml/needless_pass_by_ref_mut/needless_pass_by_ref_mut.stderr
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
error: this argument is a mutable reference, but not used mutably | ||
--> $DIR/needless_pass_by_ref_mut.rs:4:19 | ||
| | ||
LL | pub fn pub_foo(s: &mut Vec<u32>, b: &u32, x: &mut u32) { | ||
| ^^^^^^^^^^^^^ help: consider changing to: `&Vec<u32>` | ||
| | ||
= warning: changing this function will impact semver compatibility | ||
= note: `-D clippy::needless-pass-by-ref-mut` implied by `-D warnings` | ||
= help: to override `-D warnings` add `#[allow(clippy::needless_pass_by_ref_mut)]` | ||
|
||
error: aborting due to previous error | ||
|
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
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