Update to a compiletest-rs version that requires `//@` for commands

This commit is contained in:
Oli Scherer 2023-04-20 14:37:15 +00:00
parent 4d35b5e27b
commit def1705a27
724 changed files with 945 additions and 1009 deletions

View File

@ -28,7 +28,7 @@ tempfile = { version = "3.2", optional = true }
termize = "0.1"
[dev-dependencies]
compiletest_rs = { version = "0.9", features = ["tmp"] }
compiletest_rs = { version = "0.10", features = ["tmp"] }
tester = "0.9"
regex = "1.5"
toml = "0.5"

View File

@ -164,7 +164,7 @@ The process of generating the `.stderr` file is the same, and prepending the
## Rustfix tests
If the lint you are working on is making use of structured suggestions, the test
file should include a `// run-rustfix` comment at the top. This will
file should include a `//@run-rustfix` comment at the top. This will
additionally run [rustfix] for that test. Rustfix will apply the suggestions
from the lint to the code of the test file and compare that to the contents of a
`.fixed` file.

View File

@ -741,7 +741,7 @@ fn gen_deprecated_lints_test(lints: &[DeprecatedLint]) -> String {
fn gen_renamed_lints_test(lints: &[RenamedLint]) -> String {
let mut seen_lints = HashSet::new();
let mut res: String = GENERATED_FILE_COMMENT.into();
res.push_str("// run-rustfix\n\n");
res.push_str("//@run-rustfix\n\n");
for lint in lints {
if seen_lints.insert(&lint.new_name) {
writeln!(res, "#![allow({})]", lint.new_name).unwrap();

View File

@ -1,5 +1,3 @@
// run-rustfix
use super::OBFUSCATED_IF_ELSE;
use clippy_utils::{diagnostics::span_lint_and_sugg, source::snippet_with_applicability};
use rustc_errors::Applicability;

View File

@ -126,6 +126,7 @@ fn base_config(test_dir: &str) -> compiletest::Config {
let mut config = compiletest::Config {
edition: Some("2021".into()),
mode: TestMode::Ui,
strict_headers: true,
..Default::default()
};
@ -424,7 +425,7 @@ fn check_rustfix_coverage() {
.binary_search_by_key(&filename, Path::new)
.is_ok(),
"`{rs_file}` runs `MachineApplicable` diagnostics but is missing a `run-rustfix` annotation. \
Please either add `// run-rustfix` at the top of the file or add the file to \
Please either add `//@run-rustfix` at the top of the file or add the file to \
`RUSTFIX_COVERAGE_KNOWN_EXCEPTIONS` in `tests/compile-test.rs`.",
);
}

View File

@ -1,4 +1,4 @@
// compile-flags: --crate-name=cargo_common_metadata
//@compile-flags: --crate-name=cargo_common_metadata
#![warn(clippy::cargo_common_metadata)]
fn main() {}

View File

@ -1,4 +1,4 @@
// compile-flags: --crate-name=cargo_common_metadata
//@compile-flags: --crate-name=cargo_common_metadata
#![warn(clippy::cargo_common_metadata)]
fn main() {}

View File

@ -1,4 +1,4 @@
// compile-flags: --crate-name=cargo_common_metadata
//@compile-flags: --crate-name=cargo_common_metadata
#![warn(clippy::cargo_common_metadata)]
fn main() {}

View File

@ -1,4 +1,4 @@
// compile-flags: --crate-name=cargo_common_metadata
//@compile-flags: --crate-name=cargo_common_metadata
#![warn(clippy::cargo_common_metadata)]
fn main() {}

View File

@ -1,4 +1,4 @@
// compile-flags: --crate-name=cargo_common_metadata
//@compile-flags: --crate-name=cargo_common_metadata
#![warn(clippy::cargo_common_metadata)]
fn main() {}

View File

@ -1,4 +1,4 @@
// compile-flags: --crate-name=cargo_common_metadata
//@compile-flags: --crate-name=cargo_common_metadata
#![warn(clippy::cargo_common_metadata)]
fn main() {}

View File

@ -1,4 +1,4 @@
// compile-flags: --crate-name=feature_name
//@compile-flags: --crate-name=feature_name
#![warn(clippy::redundant_feature_names)]
#![warn(clippy::negative_feature_names)]

View File

@ -1,4 +1,4 @@
// compile-flags: --crate-name=feature_name
//@compile-flags: --crate-name=feature_name
#![warn(clippy::redundant_feature_names)]
#![warn(clippy::negative_feature_names)]

View File

@ -1,4 +1,4 @@
// compile-flags: --remap-path-prefix {{src-base}}=/remapped
//@compile-flags: --remap-path-prefix {{src-base}}=/remapped
#![warn(clippy::self_named_module_files)]

View File

@ -1,4 +1,4 @@
// compile-flags: --crate-name=multiple_crate_versions
//@compile-flags: --crate-name=multiple_crate_versions
#![warn(clippy::multiple_crate_versions)]
fn main() {}

View File

@ -1,4 +1,4 @@
// compile-flags: --crate-name=multiple_crate_versions
//@compile-flags: --crate-name=multiple_crate_versions
#![warn(clippy::multiple_crate_versions)]
fn main() {}

View File

@ -1,4 +1,4 @@
// compile-flags: --crate-name=multiple_crate_versions
//@compile-flags: --crate-name=multiple_crate_versions
#![warn(clippy::multiple_crate_versions)]
fn main() {}

View File

@ -1,4 +1,4 @@
// compile-flags: --crate-name=wildcard_dependencies
//@compile-flags: --crate-name=wildcard_dependencies
#![warn(clippy::wildcard_dependencies)]
fn main() {}

View File

@ -1,4 +1,4 @@
// compile-flags: --crate-name=wildcard_dependencies
//@compile-flags: --crate-name=wildcard_dependencies
#![warn(clippy::wildcard_dependencies)]
fn main() {}

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![deny(clippy::internal)]
#![allow(clippy::missing_clippy_version_attribute)]
#![feature(rustc_private)]

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![deny(clippy::internal)]
#![allow(clippy::missing_clippy_version_attribute)]
#![feature(rustc_private)]

View File

@ -1,9 +1,9 @@
// rustc-env:RUST_BACKTRACE=0
// normalize-stderr-test: "Clippy version: .*" -> "Clippy version: foo"
// normalize-stderr-test: "produce_ice.rs:\d*:\d*" -> "produce_ice.rs"
// normalize-stderr-test: "', .*clippy_lints" -> "', clippy_lints"
// normalize-stderr-test: "'rustc'" -> "'<unnamed>'"
// normalize-stderr-test: "(?ms)query stack during panic:\n.*end of query stack\n" -> ""
//@rustc-env:RUST_BACKTRACE=0
//@normalize-stderr-test: "Clippy version: .*" -> "Clippy version: foo"
//@normalize-stderr-test: "produce_ice.rs:\d*:\d*" -> "produce_ice.rs"
//@normalize-stderr-test: "', .*clippy_lints" -> "', clippy_lints"
//@normalize-stderr-test: "'rustc'" -> "'<unnamed>'"
//@normalize-stderr-test: "(?ms)query stack during panic:\n.*end of query stack\n" -> ""
#![deny(clippy::internal)]
#![allow(clippy::missing_clippy_version_attribute)]

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![deny(clippy::internal)]
#![allow(clippy::missing_clippy_version_attribute, clippy::let_unit_value)]
#![feature(rustc_private)]

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![deny(clippy::internal)]
#![allow(clippy::missing_clippy_version_attribute, clippy::let_unit_value)]
#![feature(rustc_private)]

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![deny(clippy::internal)]
#![allow(clippy::missing_clippy_version_attribute)]

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![deny(clippy::internal)]
#![allow(clippy::missing_clippy_version_attribute)]

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![deny(clippy::internal)]
#![allow(clippy::missing_clippy_version_attribute)]

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![deny(clippy::internal)]
#![allow(clippy::missing_clippy_version_attribute)]

View File

@ -1,5 +1,5 @@
// run-rustfix
// aux-build:paths.rs
//@run-rustfix
//@aux-build:paths.rs
#![deny(clippy::internal)]
#![feature(rustc_private)]

View File

@ -1,5 +1,5 @@
// run-rustfix
// aux-build:paths.rs
//@run-rustfix
//@aux-build:paths.rs
#![deny(clippy::internal)]
#![feature(rustc_private)]

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![feature(rustc_private)]
#![deny(clippy::internal)]
#![allow(

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![feature(rustc_private)]
#![deny(clippy::internal)]
#![allow(

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![warn(clippy::uninlined_format_args)]
fn main() {

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![warn(clippy::uninlined_format_args)]
fn main() {

View File

@ -1,4 +1,4 @@
// compile-flags: --test
//@compile-flags: --test
#![warn(clippy::dbg_macro)]
fn foo(n: u32) -> u32 {

View File

@ -1,4 +1,4 @@
// aux-build:macros.rs
//@aux-build:macros.rs
#![allow(unused)]

View File

@ -1,4 +1,4 @@
// compile-flags: --test
//@compile-flags: --test
#![warn(clippy::expect_used)]
fn expect_option() {

View File

@ -1,4 +1,4 @@
// compile-flags: --crate-name mut_key
//@compile-flags: --crate-name mut_key
#![warn(clippy::mutable_key_type)]

View File

@ -1,5 +1,5 @@
// compile-flags: --emit=link
// no-prefer-dynamic
//@compile-flags: --emit=link
//@no-prefer-dynamic
#![crate_type = "proc-macro"]

View File

@ -1,5 +1,5 @@
// aux-build:proc_macro_derive.rs
// run-rustfix
//@aux-build:proc_macro_derive.rs
//@run-rustfix
#![warn(clippy::nonstandard_macro_braces)]

View File

@ -1,5 +1,5 @@
// aux-build:proc_macro_derive.rs
// run-rustfix
//@aux-build:proc_macro_derive.rs
//@run-rustfix
#![warn(clippy::nonstandard_macro_braces)]

View File

@ -1,4 +1,4 @@
// compile-flags: --test
//@compile-flags: --test
#![warn(clippy::print_stdout)]
#![warn(clippy::print_stderr)]

View File

@ -1,4 +1,4 @@
// compile-flags: --crate-name conf_disallowed_methods
//@compile-flags: --crate-name conf_disallowed_methods
#![warn(clippy::disallowed_methods)]

View File

@ -1,5 +1,5 @@
// normalize-stderr-test "\(\d+ byte\)" -> "(N byte)"
// normalize-stderr-test "\(limit: \d+ byte\)" -> "(limit: N byte)"
//@normalize-stderr-test: "\(\d+ byte\)" -> "(N byte)"
//@normalize-stderr-test: "\(limit: \d+ byte\)" -> "(limit: N byte)"
#![deny(clippy::trivially_copy_pass_by_ref)]

View File

@ -1 +1,3 @@
//@error-pattern: unknown field `foobar`, expected one of
fn main() {}

View File

@ -1,4 +1,4 @@
// compile-flags: --test
//@compile-flags: --test
#![allow(unused_mut, clippy::get_first, clippy::from_iter_instead_of_collect)]
#![warn(clippy::unwrap_used)]

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![allow(unused)]
#![warn(clippy::allow_attributes)]
#![feature(lint_reasons)]

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![allow(unused)]
#![warn(clippy::allow_attributes)]
#![feature(lint_reasons)]

View File

@ -1,6 +1,6 @@
// run-rustfix
// edition:2018
// aux-build:proc_macros.rs
//@run-rustfix
//@edition:2018
//@aux-build:proc_macros.rs
#![feature(exclusive_range_pattern)]
#![feature(stmt_expr_attributes)]

View File

@ -1,6 +1,6 @@
// run-rustfix
// edition:2018
// aux-build:proc_macros.rs
//@run-rustfix
//@edition:2018
//@aux-build:proc_macros.rs
#![feature(exclusive_range_pattern)]
#![feature(stmt_expr_attributes)]

View File

@ -1,4 +1,4 @@
// aux-build:proc_macro_derive.rs
//@aux-build:proc_macro_derive.rs
#![allow(
clippy::assign_op_pattern,

View File

@ -1,4 +1,4 @@
// aux-build:proc_macros.rs
//@aux-build:proc_macros.rs
#![warn(clippy::as_conversions)]
#![allow(clippy::borrow_as_ptr)]

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![warn(clippy::as_underscore)]

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![warn(clippy::as_underscore)]

View File

@ -1,5 +1,5 @@
// only-x86_64
// ignore-aarch64
//@only-x86_64
//@ignore-aarch64
#[warn(clippy::inline_asm_x86_intel_syntax)]
mod warn_intel {

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![warn(clippy::assertions_on_result_states)]
use std::result::Result;

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![warn(clippy::assertions_on_result_states)]
use std::result::Result;

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
use core::num::Wrapping;

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
use core::num::Wrapping;

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![feature(lint_reasons)]
#![feature(async_closure)]
#![warn(clippy::async_yields_async)]

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![feature(lint_reasons)]
#![feature(async_closure)]
#![warn(clippy::async_yields_async)]

View File

@ -1,4 +1,4 @@
// edition:2018
//@edition:2018
#![allow(redundant_semicolons, clippy::no_effect)]
#![feature(stmt_expr_attributes)]

View File

@ -1,5 +1,5 @@
// compile-flags: --emit=link
// no-prefer-dynamic
//@compile-flags: --emit=link
//@no-prefer-dynamic
#![crate_type = "proc-macro"]
#![feature(repr128, proc_macro_hygiene, proc_macro_quote, box_patterns)]

View File

@ -1,5 +1,5 @@
// compile-flags: --emit=link
// no-prefer-dynamic
//@compile-flags: --emit=link
//@no-prefer-dynamic
#![crate_type = "proc-macro"]
#![feature(repr128, proc_macro_quote)]

View File

@ -1,5 +1,5 @@
// compile-flags: --emit=link
// no-prefer-dynamic
//@compile-flags: --emit=link
//@no-prefer-dynamic
#![crate_type = "proc-macro"]

View File

@ -1,5 +1,5 @@
// compile-flags: --emit=link
// no-prefer-dynamic
//@compile-flags: --emit=link
//@no-prefer-dynamic
#![crate_type = "proc-macro"]

View File

@ -1,5 +1,5 @@
// compile-flags: --emit=link
// no-prefer-dynamic
//@compile-flags: --emit=link
//@no-prefer-dynamic
#![crate_type = "proc-macro"]
#![feature(let_chains)]

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![deny(clippy::bind_instead_of_map)]
#![allow(clippy::uninlined_format_args)]

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![deny(clippy::bind_instead_of_map)]
#![allow(clippy::uninlined_format_args)]

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![deny(clippy::bind_instead_of_map)]
#![allow(clippy::blocks_in_if_conditions)]

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![deny(clippy::bind_instead_of_map)]
#![allow(clippy::blocks_in_if_conditions)]

View File

@ -1,4 +1,4 @@
// compile-flags: -W clippy::restriction
//@compile-flags: -W clippy::restriction
#![warn(clippy::blanket_clippy_restriction_lints)]

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![warn(clippy::blocks_in_if_conditions)]
#![allow(unused, clippy::let_and_return)]
#![warn(clippy::nonminimal_bool)]

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![warn(clippy::blocks_in_if_conditions)]
#![allow(unused, clippy::let_and_return)]
#![warn(clippy::nonminimal_bool)]

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![allow(unused, clippy::assertions_on_constants)]
#![warn(clippy::bool_assert_comparison)]

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![allow(unused, clippy::assertions_on_constants)]
#![warn(clippy::bool_assert_comparison)]

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![warn(clippy::bool_comparison)]

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![warn(clippy::bool_comparison)]

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![feature(let_chains)]
#![warn(clippy::bool_to_int_with_if)]

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![feature(let_chains)]
#![warn(clippy::bool_to_int_with_if)]

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![warn(clippy::borrow_as_ptr)]
fn main() {

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![warn(clippy::borrow_as_ptr)]
fn main() {

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![warn(clippy::borrow_as_ptr)]
#![feature(lang_items, start, libc)]
#![no_std]

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![warn(clippy::borrow_as_ptr)]
#![feature(lang_items, start, libc)]
#![no_std]

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![allow(dead_code, unused_variables)]

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![allow(dead_code, unused_variables)]

View File

@ -1,4 +1,4 @@
// aux-build:helper.rs
//@aux-build:helper.rs
#![warn(clippy::borrow_interior_mutable_const)]
#![allow(clippy::declare_interior_mutable_const)]

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![warn(clippy::box_default)]
#[derive(Default)]

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![warn(clippy::box_default)]
#[derive(Default)]

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![warn(clippy::bytes_count_to_len)]
use std::fs::File;
use std::io::Read;

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![warn(clippy::bytes_count_to_len)]
use std::fs::File;
use std::io::Read;

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![allow(clippy::unnecessary_operation)]
#![warn(clippy::bytes_nth)]

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![allow(clippy::unnecessary_operation)]
#![warn(clippy::bytes_nth)]

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![warn(clippy::case_sensitive_file_extension_comparisons)]
use std::string::String;

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![warn(clippy::case_sensitive_file_extension_comparisons)]
use std::string::String;

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![warn(clippy::cast_abs_to_unsigned)]
#![allow(clippy::uninlined_format_args, unused)]

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![warn(clippy::cast_abs_to_unsigned)]
#![allow(clippy::uninlined_format_args, unused)]

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![allow(dead_code)]
#![warn(clippy::cast_lossless)]

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![allow(dead_code)]
#![warn(clippy::cast_lossless)]

View File

@ -1,4 +1,4 @@
// run-rustfix
//@run-rustfix
#![allow(clippy::no_effect, clippy::unnecessary_operation, dead_code)]
#![warn(clippy::cast_lossless)]

Some files were not shown because too many files have changed in this diff Show More