-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ui test for
include_file_outside_project
lint
- Loading branch information
1 parent
a6ab226
commit d6dc48d
Showing
2 changed files
with
27 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
//@ normalize-stderr-test: "located at `.+/.crates.toml`" -> "located at `$$DIR/.crates.toml`" | ||
//@ normalize-stderr-test: "folder \(`.+`" -> "folder (`$$CLIPPY_DIR`" | ||
|
||
#![deny(clippy::include_file_outside_project)] | ||
|
||
// Should not lint. | ||
include!("./auxiliary/external_consts.rs"); | ||
|
||
fn main() { | ||
let x = include_str!(concat!(env!("CARGO_HOME"), "/.crates.toml")); | ||
//~^ include_file_outside_project | ||
} |
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,15 @@ | ||
error: attempted to include a file outside of the project | ||
--> tests/ui/include_file_outside_project.rs:10:13 | ||
| | ||
LL | let x = include_str!(concat!(env!("CARGO_HOME"), "/.crates.toml")); | ||
| ^ | ||
| | ||
= note: file is located at `$DIR/.crates.toml` which is outside of project folder (`$CLIPPY_DIR`) | ||
note: the lint level is defined here | ||
--> tests/ui/include_file_outside_project.rs:4:9 | ||
| | ||
LL | #![deny(clippy::include_file_outside_project)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 1 previous error | ||
|