Skip to content

Allow all unused lints inside ui tests #7611

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/adding_lints.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ currently this test is meaningless though.

While we are working on implementing our lint, we can keep running the UI
test. That allows us to check if the output is turning into what we want.
Other lints can be allowed inside the test file to focus on the current
implementation, most [unused lints] are already ignored by default.

Once we are satisfied with the output, we need to run
`cargo dev bless` to update the `.stderr` file for our lint.
Expand All @@ -113,6 +115,8 @@ empty, they should be removed.
Note that you can run multiple test files by specifying a comma separated list:
`TESTNAME=foo_functions,test2,test3`.

[unused lints]: https://doc.rust-lang.org/rustc/lints/groups.html#lint-groups

### Cargo lints

For cargo lints, the process of testing differs in that we are interested in
Expand Down
5 changes: 4 additions & 1 deletion tests/compile-test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ mod cargo;
// whether to run internal tests or not
const RUN_INTERNAL_TESTS: bool = cfg!(feature = "internal-lints");

const DEFAULT_LINT_CONFIG: &str = "-A unused";

fn host_lib() -> PathBuf {
option_env!("HOST_LIBS").map_or(cargo::CARGO_TARGET_DIR.join(env!("PROFILE")), PathBuf::from)
}
Expand Down Expand Up @@ -106,10 +108,11 @@ fn default_config() -> compiletest::Config {
}

config.target_rustcflags = Some(format!(
"--emit=metadata -L {0} -L {1} -Dwarnings -Zui-testing {2}",
"--emit=metadata -L {0} -L {1} -Dwarnings -Zui-testing {2} {3}",
host_lib().join("deps").display(),
cargo::TARGET_LIB.join("deps").display(),
third_party_crates(),
DEFAULT_LINT_CONFIG,
));

config.build_base = host_lib().join("test_build_base");
Expand Down