-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #6244 - mikerite:invalid_paths_20201027, r=flip1995
New internal lint: Invalid paths Add a new internal lint that detects invalid paths in the `util::paths` and fix some invalid paths found. This commit partially addresses #6047 but the lint would have to be run before running tests to close that issue. changelog: none
- Loading branch information
Showing
8 changed files
with
163 additions
and
15 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
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,23 @@ | ||
#![warn(clippy::internal)] | ||
|
||
mod paths { | ||
// Good path | ||
pub const ANY_TRAIT: [&str; 3] = ["std", "any", "Any"]; | ||
|
||
// Path to method on inherent impl of a primitive type | ||
pub const F32_EPSILON: [&str; 4] = ["core", "f32", "<impl f32>", "EPSILON"]; | ||
|
||
// Path to method on inherent impl | ||
pub const ARC_PTR_EQ: [&str; 4] = ["alloc", "sync", "Arc", "ptr_eq"]; | ||
|
||
// Path with empty segment | ||
pub const TRANSMUTE: [&str; 4] = ["core", "intrinsics", "", "transmute"]; | ||
|
||
// Path with bad crate | ||
pub const BAD_CRATE_PATH: [&str; 2] = ["bad", "path"]; | ||
|
||
// Path with bad module | ||
pub const BAD_MOD_PATH: [&str; 2] = ["std", "xxx"]; | ||
} | ||
|
||
fn main() {} |
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 @@ | ||
error: invalid path | ||
--> $DIR/invalid_paths.rs:17:5 | ||
| | ||
LL | pub const BAD_CRATE_PATH: [&str; 2] = ["bad", "path"]; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: `-D clippy::clippy-lints-internal` implied by `-D warnings` | ||
|
||
error: invalid path | ||
--> $DIR/invalid_paths.rs:20:5 | ||
| | ||
LL | pub const BAD_MOD_PATH: [&str; 2] = ["std", "xxx"]; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 2 previous errors | ||
|