Skip to content
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

Remove $DIR replacement #12306

Merged
merged 2 commits into from
Feb 19, 2024
Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .github/driver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ test "$sysroot" = $desired_sysroot
)

# Check that the --sysroot argument is only passed once via arg_file.txt (SYSROOT is ignored)
(
(
echo "fn main() {}" > target/driver_test.rs
echo "--sysroot="$(./target/debug/clippy-driver --print sysroot)"" > arg_file.txt
echo "--verbose" >> arg_file.txt
Expand All @@ -45,7 +45,7 @@ unset CARGO_MANIFEST_DIR
# Run a lint and make sure it produces the expected output. It's also expected to exit with code 1
# FIXME: How to match the clippy invocation in compile-test.rs?
./target/debug/clippy-driver -Dwarnings -Aunused -Zui-testing --emit metadata --crate-type bin tests/ui/double_neg.rs 2>double_neg.stderr && exit 1
sed -e "s,tests/ui,\$DIR," -e "/= help: for/d" double_neg.stderr > normalized.stderr
sed -e "/= help: for/d" double_neg.stderr > normalized.stderr
diff -u normalized.stderr tests/ui/double_neg.stderr

# make sure "clippy-driver --rustc --arg" and "rustc --arg" behave the same
Expand Down
10 changes: 5 additions & 5 deletions book/src/development/emitting_lints.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ The output looks something like this (from the example earlier):

```text
error: an inclusive range would be more readable
--> $DIR/range_plus_minus_one.rs:37:14
--> tests/ui/range_plus_minus_one.rs:37:14
|
LL | for _ in 1..1 + 1 {}
| ^^^^^^^^ help: use: `1..=1`
Expand Down Expand Up @@ -135,14 +135,14 @@ Examples:

```text
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
--> $DIR/drop_forget_ref.rs:10:5
--> tests/ui/drop_forget_ref.rs:10:5
|
10 | forget(&SomeStruct);
| ^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::forget-ref` implied by `-D warnings`
note: argument has type &SomeStruct
--> $DIR/drop_forget_ref.rs:10:12
--> tests/ui/drop_forget_ref.rs:10:12
|
10 | forget(&SomeStruct);
| ^^^^^^^^^^^
Expand All @@ -158,7 +158,7 @@ Example:

```text
error: constant division of 0.0 with 0.0 will always result in NaN
--> $DIR/zero_div_zero.rs:6:25
--> tests/ui/zero_div_zero.rs:6:25
|
6 | let other_f64_nan = 0.0f64 / 0.0;
| ^^^^^^^^^^^^
Expand All @@ -176,7 +176,7 @@ Example:

```text
error: This `.fold` can be more succinctly expressed as `.any`
--> $DIR/methods.rs:390:13
--> tests/ui/methods.rs:390:13
|
390 | let _ = (0..3).fold(false, |acc, x| acc || x > 2);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `.any(|x| x > 2)`
Expand Down
6 changes: 3 additions & 3 deletions book/src/development/writing_tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,19 +97,19 @@ failures:
---- compile_test stdout ----
normalized stderr:
error: function called "foo"
--> $DIR/foo_functions.rs:6:12
--> tests/ui/foo_functions.rs:6:12
|
LL | pub fn foo(&self) {}
| ^^^
|
= note: `-D clippy::foo-functions` implied by `-D warnings`
error: function called "foo"
--> $DIR/foo_functions.rs:13:8
--> tests/ui/foo_functions.rs:13:8
|
LL | fn foo(&self) {}
| ^^^
error: function called "foo"
--> $DIR/foo_functions.rs:19:4
--> tests/ui/foo_functions.rs:19:4
|
LL | fn foo() {}
| ^^^
Expand Down
10 changes: 5 additions & 5 deletions clippy_utils/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fn docs_link(diag: &mut Diagnostic, lint: &'static Lint) {
///
/// ```ignore
/// error: usage of mem::forget on Drop type
/// --> $DIR/mem_forget.rs:17:5
/// --> tests/ui/mem_forget.rs:17:5
/// |
/// 17 | std::mem::forget(seven);
/// | ^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -65,7 +65,7 @@ pub fn span_lint<T: LintContext>(cx: &T, lint: &'static Lint, sp: impl Into<Mult
///
/// ```text
/// error: constant division of 0.0 with 0.0 will always result in NaN
/// --> $DIR/zero_div_zero.rs:6:25
/// --> tests/ui/zero_div_zero.rs:6:25
/// |
/// 6 | let other_f64_nan = 0.0f64 / 0.0;
/// | ^^^^^^^^^^^^
Expand Down Expand Up @@ -103,14 +103,14 @@ pub fn span_lint_and_help<T: LintContext>(
///
/// ```text
/// error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
/// --> $DIR/drop_forget_ref.rs:10:5
/// --> tests/ui/drop_forget_ref.rs:10:5
/// |
/// 10 | forget(&SomeStruct);
/// | ^^^^^^^^^^^^^^^^^^^
/// |
/// = note: `-D clippy::forget-ref` implied by `-D warnings`
/// note: argument has type &SomeStruct
/// --> $DIR/drop_forget_ref.rs:10:12
/// --> tests/ui/drop_forget_ref.rs:10:12
/// |
/// 10 | forget(&SomeStruct);
/// | ^^^^^^^^^^^
Expand Down Expand Up @@ -186,7 +186,7 @@ pub fn span_lint_hir_and_then(
///
/// ```text
/// error: This `.fold` can be more succinctly expressed as `.any`
/// --> $DIR/methods.rs:390:13
/// --> tests/ui/methods.rs:390:13
/// |
/// 390 | let _ = (0..3).fold(false, |acc, x| acc || x > 2);
/// | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `.any(|x| x > 2)`
Expand Down
1 change: 0 additions & 1 deletion tests/compile-test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ fn base_config(test_dir: &str) -> (Config, Args) {
}))
.into();
config.comment_defaults.base().diagnostic_code_prefix = Some(Spanned::dummy("clippy::".into())).into();
config.filter(&format!("tests/{test_dir}"), "$$DIR");
config.with_args(&args);
let current_exe_path = env::current_exe().unwrap();
let deps_path = current_exe_path.parent().unwrap();
Expand Down
2 changes: 1 addition & 1 deletion tests/ui-cargo/multiple_config_files/warn/Cargo.stderr
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
warning: using config file `$DIR/$DIR/multiple_config_files/warn/.clippy.toml`, `$DIR/$DIR/multiple_config_files/warn/clippy.toml` will be ignored
warning: using config file `$DIR/tests/ui-cargo/multiple_config_files/warn/.clippy.toml`, `$DIR/tests/ui-cargo/multiple_config_files/warn/clippy.toml` will be ignored

10 changes: 5 additions & 5 deletions tests/ui-internal/check_clippy_version_attribute.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: this item has an invalid `clippy::version` attribute
--> $DIR/check_clippy_version_attribute.rs:40:1
--> tests/ui-internal/check_clippy_version_attribute.rs:40:1
|
LL | / declare_tool_lint! {
LL | | #[clippy::version = "1.2.3.4.5.6"]
Expand All @@ -12,15 +12,15 @@ LL | | }
|
= help: please use a valid semantic version, see `doc/adding_lints.md`
note: the lint level is defined here
--> $DIR/check_clippy_version_attribute.rs:1:9
--> tests/ui-internal/check_clippy_version_attribute.rs:1:9
|
LL | #![deny(clippy::internal)]
| ^^^^^^^^^^^^^^^^
= note: `#[deny(clippy::invalid_clippy_version_attribute)]` implied by `#[deny(clippy::internal)]`
= note: this error originates in the macro `$crate::declare_tool_lint` which comes from the expansion of the macro `declare_tool_lint` (in Nightly builds, run with -Z macro-backtrace for more info)

error: this item has an invalid `clippy::version` attribute
--> $DIR/check_clippy_version_attribute.rs:48:1
--> tests/ui-internal/check_clippy_version_attribute.rs:48:1
|
LL | / declare_tool_lint! {
LL | | #[clippy::version = "I'm a string"]
Expand All @@ -35,7 +35,7 @@ LL | | }
= note: this error originates in the macro `$crate::declare_tool_lint` which comes from the expansion of the macro `declare_tool_lint` (in Nightly builds, run with -Z macro-backtrace for more info)

error: this lint is missing the `clippy::version` attribute or version value
--> $DIR/check_clippy_version_attribute.rs:59:1
--> tests/ui-internal/check_clippy_version_attribute.rs:59:1
|
LL | / declare_tool_lint! {
LL | | #[clippy::version]
Expand All @@ -51,7 +51,7 @@ LL | | }
= note: this error originates in the macro `$crate::declare_tool_lint` which comes from the expansion of the macro `declare_tool_lint` (in Nightly builds, run with -Z macro-backtrace for more info)

error: this lint is missing the `clippy::version` attribute or version value
--> $DIR/check_clippy_version_attribute.rs:67:1
--> tests/ui-internal/check_clippy_version_attribute.rs:67:1
|
LL | / declare_tool_lint! {
LL | | pub clippy::MISSING_ATTRIBUTE_TWO,
Expand Down
4 changes: 2 additions & 2 deletions tests/ui-internal/check_formulation.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: non-standard lint formulation
--> $DIR/check_formulation.rs:23:5
--> tests/ui-internal/check_formulation.rs:23:5
|
LL | /// Check for lint formulations that are correct
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -9,7 +9,7 @@ LL | /// Check for lint formulations that are correct
= help: to override `-D warnings` add `#[allow(clippy::almost_standard_lint_formulation)]`

error: non-standard lint formulation
--> $DIR/check_formulation.rs:33:5
--> tests/ui-internal/check_formulation.rs:33:5
|
LL | /// Detects uses of incorrect formulations
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
12 changes: 6 additions & 6 deletions tests/ui-internal/collapsible_span_lint_calls.stderr
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
error: this call is collapsible
--> $DIR/collapsible_span_lint_calls.rs:35:9
--> tests/ui-internal/collapsible_span_lint_calls.rs:35:9
|
LL | / span_lint_and_then(cx, TEST_LINT, expr.span, lint_msg, |db| {
LL | | db.span_suggestion(expr.span, help_msg, sugg.to_string(), Applicability::MachineApplicable);
LL | | });
| |__________^ help: collapse into: `span_lint_and_sugg(cx, TEST_LINT, expr.span, lint_msg, help_msg, sugg.to_string(), Applicability::MachineApplicable)`
|
note: the lint level is defined here
--> $DIR/collapsible_span_lint_calls.rs:1:9
--> tests/ui-internal/collapsible_span_lint_calls.rs:1:9
|
LL | #![deny(clippy::internal)]
| ^^^^^^^^^^^^^^^^
= note: `#[deny(clippy::collapsible_span_lint_calls)]` implied by `#[deny(clippy::internal)]`

error: this call is collapsible
--> $DIR/collapsible_span_lint_calls.rs:38:9
--> tests/ui-internal/collapsible_span_lint_calls.rs:38:9
|
LL | / span_lint_and_then(cx, TEST_LINT, expr.span, lint_msg, |db| {
LL | | db.span_help(expr.span, help_msg);
LL | | });
| |__________^ help: collapse into: `span_lint_and_help(cx, TEST_LINT, expr.span, lint_msg, Some(expr.span), help_msg)`

error: this call is collapsible
--> $DIR/collapsible_span_lint_calls.rs:41:9
--> tests/ui-internal/collapsible_span_lint_calls.rs:41:9
|
LL | / span_lint_and_then(cx, TEST_LINT, expr.span, lint_msg, |db| {
LL | | db.help(help_msg);
LL | | });
| |__________^ help: collapse into: `span_lint_and_help(cx, TEST_LINT, expr.span, lint_msg, None, help_msg)`

error: this call is collapsible
--> $DIR/collapsible_span_lint_calls.rs:44:9
--> tests/ui-internal/collapsible_span_lint_calls.rs:44:9
|
LL | / span_lint_and_then(cx, TEST_LINT, expr.span, lint_msg, |db| {
LL | | db.span_note(expr.span, note_msg);
LL | | });
| |__________^ help: collapse into: `span_lint_and_note(cx, TEST_LINT, expr.span, lint_msg, Some(expr.span), note_msg)`

error: this call is collapsible
--> $DIR/collapsible_span_lint_calls.rs:47:9
--> tests/ui-internal/collapsible_span_lint_calls.rs:47:9
|
LL | / span_lint_and_then(cx, TEST_LINT, expr.span, lint_msg, |db| {
LL | | db.note(note_msg);
Expand Down
4 changes: 2 additions & 2 deletions tests/ui-internal/default_deprecation_reason.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: the lint `COOL_LINT_DEFAULT` has the default deprecation reason
--> $DIR/default_deprecation_reason.rs:8:1
--> tests/ui-internal/default_deprecation_reason.rs:8:1
|
LL | / declare_deprecated_lint! {
LL | | /// ### What it does
Expand All @@ -11,7 +11,7 @@ LL | | }
| |_^
|
note: the lint level is defined here
--> $DIR/default_deprecation_reason.rs:1:9
--> tests/ui-internal/default_deprecation_reason.rs:1:9
|
LL | #![deny(clippy::internal)]
| ^^^^^^^^^^^^^^^^
Expand Down
4 changes: 2 additions & 2 deletions tests/ui-internal/default_lint.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: the lint `TEST_LINT_DEFAULT` has the default lint description
--> $DIR/default_lint.rs:18:1
--> tests/ui-internal/default_lint.rs:18:1
|
LL | / declare_tool_lint! {
LL | | pub clippy::TEST_LINT_DEFAULT,
Expand All @@ -10,7 +10,7 @@ LL | | }
| |_^
|
note: the lint level is defined here
--> $DIR/default_lint.rs:1:9
--> tests/ui-internal/default_lint.rs:1:9
|
LL | #![deny(clippy::internal)]
| ^^^^^^^^^^^^^^^^
Expand Down
4 changes: 2 additions & 2 deletions tests/ui-internal/disallow_span_lint.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: use of a disallowed method `rustc_lint::context::LintContext::span_lint`
--> $DIR/disallow_span_lint.rs:14:5
--> tests/ui-internal/disallow_span_lint.rs:14:5
|
LL | cx.span_lint(lint, span, msg, |_| {});
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -8,7 +8,7 @@ LL | cx.span_lint(lint, span, msg, |_| {});
= help: to override `-D warnings` add `#[allow(clippy::disallowed_methods)]`

error: use of a disallowed method `rustc_middle::ty::context::TyCtxt::node_span_lint`
--> $DIR/disallow_span_lint.rs:24:5
--> tests/ui-internal/disallow_span_lint.rs:24:5
|
LL | tcx.node_span_lint(lint, hir_id, span, msg, |_| {});
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
10 changes: 5 additions & 5 deletions tests/ui-internal/interning_defined_symbol.stderr
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
error: interning a defined symbol
--> $DIR/interning_defined_symbol.rs:17:13
--> tests/ui-internal/interning_defined_symbol.rs:17:13
|
LL | let _ = Symbol::intern("f32");
| ^^^^^^^^^^^^^^^^^^^^^ help: try: `rustc_span::sym::f32`
|
note: the lint level is defined here
--> $DIR/interning_defined_symbol.rs:1:9
--> tests/ui-internal/interning_defined_symbol.rs:1:9
|
LL | #![deny(clippy::internal)]
| ^^^^^^^^^^^^^^^^
= note: `#[deny(clippy::interning_defined_symbol)]` implied by `#[deny(clippy::internal)]`

error: interning a defined symbol
--> $DIR/interning_defined_symbol.rs:20:13
--> tests/ui-internal/interning_defined_symbol.rs:20:13
|
LL | let _ = sym!(f32);
| ^^^^^^^^^ help: try: `rustc_span::sym::f32`

error: interning a defined symbol
--> $DIR/interning_defined_symbol.rs:23:13
--> tests/ui-internal/interning_defined_symbol.rs:23:13
|
LL | let _ = Symbol::intern("proc-macro");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `rustc_span::sym::proc_dash_macro`

error: interning a defined symbol
--> $DIR/interning_defined_symbol.rs:26:13
--> tests/ui-internal/interning_defined_symbol.rs:26:13
|
LL | let _ = Symbol::intern("self");
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `rustc_span::symbol::kw::SelfLower`
Expand Down
6 changes: 3 additions & 3 deletions tests/ui-internal/invalid_msrv_attr_impl.stderr
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
error: `extract_msrv_attr!` macro missing from `LateLintPass` implementation
--> $DIR/invalid_msrv_attr_impl.rs:28:1
--> tests/ui-internal/invalid_msrv_attr_impl.rs:28:1
|
LL | impl LateLintPass<'_> for Pass {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: the lint level is defined here
--> $DIR/invalid_msrv_attr_impl.rs:1:9
--> tests/ui-internal/invalid_msrv_attr_impl.rs:1:9
|
LL | #![deny(clippy::internal)]
| ^^^^^^^^^^^^^^^^
Expand All @@ -17,7 +17,7 @@ LL + extract_msrv_attr!(LateContext);
|

error: `extract_msrv_attr!` macro missing from `EarlyLintPass` implementation
--> $DIR/invalid_msrv_attr_impl.rs:32:1
--> tests/ui-internal/invalid_msrv_attr_impl.rs:32:1
|
LL | impl EarlyLintPass for Pass {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
6 changes: 3 additions & 3 deletions tests/ui-internal/invalid_paths.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: invalid path
--> $DIR/invalid_paths.rs:15:5
--> tests/ui-internal/invalid_paths.rs:15:5
|
LL | pub const TRANSMUTE: [&str; 4] = ["core", "intrinsics", "", "transmute"];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -8,13 +8,13 @@ LL | pub const TRANSMUTE: [&str; 4] = ["core", "intrinsics", "", "transmute"
= help: to override `-D warnings` add `#[allow(clippy::invalid_paths)]`

error: invalid path
--> $DIR/invalid_paths.rs:18:5
--> tests/ui-internal/invalid_paths.rs:18:5
|
LL | pub const BAD_CRATE_PATH: [&str; 2] = ["bad", "path"];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: invalid path
--> $DIR/invalid_paths.rs:21:5
--> tests/ui-internal/invalid_paths.rs:21:5
|
LL | pub const BAD_MOD_PATH: [&str; 2] = ["std", "xxx"];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
4 changes: 2 additions & 2 deletions tests/ui-internal/lint_without_lint_pass.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: the lint `TEST_LINT` is not added to any `LintPass`
--> $DIR/lint_without_lint_pass.rs:12:1
--> tests/ui-internal/lint_without_lint_pass.rs:12:1
|
LL | / declare_tool_lint! {
LL | | pub clippy::TEST_LINT,
Expand All @@ -10,7 +10,7 @@ LL | | }
| |_^
|
note: the lint level is defined here
--> $DIR/lint_without_lint_pass.rs:1:9
--> tests/ui-internal/lint_without_lint_pass.rs:1:9
|
LL | #![deny(clippy::internal)]
| ^^^^^^^^^^^^^^^^
Expand Down
Loading
Loading