Skip to content

Commit dcb5724

Browse files
Add ui test for include_file_outside_project lint
1 parent a6ab226 commit dcb5724

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#![deny(clippy::include_file_outside_project)]
2+
3+
// Should not lint.
4+
include!("./auxiliary/external_consts.rs");
5+
6+
fn main() {
7+
let x = include_str!(concat!(env!("CARGO_HOME"), "/.crates.toml"));
8+
//~^ include_file_outside_project
9+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error: attempted to include a file outside of the project
2+
--> tests/ui/include_file_outside_project.rs:7:13
3+
|
4+
LL | let x = include_str!(concat!(env!("CARGO_HOME"), "/.crates.toml"));
5+
| ^
6+
|
7+
= note: file is located at `/home/imperio/.cargo/.crates.toml` which is outside of project folder (`/home/imperio/rust/clippy`)
8+
note: the lint level is defined here
9+
--> tests/ui/include_file_outside_project.rs:1:9
10+
|
11+
LL | #![deny(clippy::include_file_outside_project)]
12+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
13+
14+
error: aborting due to 1 previous error
15+

0 commit comments

Comments
 (0)