-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Two improvements to
disallowed_*
(#13669)
The improvements are as follows: - Remove an [unnecessary `compile-flags` directive](https://github.com/rust-lang/rust-clippy/blob/f712eb5cdccd121d0569af12f20e6a0fabe4364d/tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs#L1) in `tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs` - Support replacements as suggested by @mitsuhiko in rust-lang/rust-clippy#7609 (comment) --- changelog: support replacements in `disallowed_methods`
- Loading branch information
Showing
19 changed files
with
222 additions
and
71 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
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
1 change: 1 addition & 0 deletions
1
tests/ui-toml/await_holding_invalid_type_with_replacement/await_holding_invalid_type.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 @@ | ||
fn main() {} |
11 changes: 11 additions & 0 deletions
11
tests/ui-toml/await_holding_invalid_type_with_replacement/await_holding_invalid_type.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,11 @@ | ||
error: error reading Clippy's configuration file: replacement not allowed for this configuration | ||
--> $DIR/tests/ui-toml/await_holding_invalid_type_with_replacement/clippy.toml:1:31 | ||
| | ||
LL | await-holding-invalid-types = [ | ||
| _______________________________^ | ||
LL | | { path = "std::string::String", replacement = "std::net::Ipv4Addr" }, | ||
LL | | ] | ||
| |_^ | ||
|
||
error: aborting due to 1 previous error | ||
|
3 changes: 3 additions & 0 deletions
3
tests/ui-toml/await_holding_invalid_type_with_replacement/clippy.toml
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,3 @@ | ||
await-holding-invalid-types = [ | ||
{ path = "std::string::String", replacement = "std::net::Ipv4Addr" }, | ||
] |
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,3 @@ | ||
disallowed-types = [ | ||
{ path = "std::string::String", replacement = "wrapper::String" }, | ||
] |
16 changes: 16 additions & 0 deletions
16
tests/ui-toml/replaceable_disallowed_types/replaceable_disallowed_types.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,16 @@ | ||
#![warn(clippy::disallowed_types)] | ||
|
||
#[allow(clippy::disallowed_types)] | ||
mod wrapper { | ||
pub struct String(std::string::String); | ||
|
||
impl From<&str> for String { | ||
fn from(value: &str) -> Self { | ||
Self(std::string::String::from(value)) | ||
} | ||
} | ||
} | ||
|
||
fn main() { | ||
let _ = wrapper::String::from("x"); | ||
} |
Oops, something went wrong.