Skip to content

Commit d1b2d6d

Browse files
authored
Rollup merge of rust-lang#60169 - varkor:tidy-unnecessary-ignore-newline, r=kennytm
Warn when ignore-tidy-linelength is present, but no lines are too long It's easy for a `// ignore-tidy-linelength` to be added when there is a genuine need to ignore a file's line length, but then after refactoring the need is gone, but the tidy directive is not removed. This means that in the future, further editing may accidentally add unnecessarily long lines. This change forces `// ignore-tidy-linelength` to be used exactly when necessary, to make sure such changes are intentional.
2 parents 88a1dee + 5ab5806 commit d1b2d6d

File tree

114 files changed

+182
-250
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+182
-250
lines changed

src/ci/docker/dist-various-1/install-x86_64-redox.sh

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env bash
2-
# ignore-tidy-linelength
32

43
set -ex
54

src/ci/docker/dist-various-2/build-fuchsia-toolchain.sh

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#!/usr/bin/env bash
22

3-
# ignore-tidy-linelength
4-
53
set -ex
64
source shared.sh
75

src/test/codegen-units/item-collection/cross-crate-closures.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// ignoring this test until MIR codegen has taken over completely
44
// ignore-test
55

6-
// ignore-tidy-linelength
76
// compile-flags:-Zprint-mono-items=eager
87

98
#![deny(dead_code)]

src/test/codegen-units/item-collection/cross-crate-generic-functions.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// ignore-tidy-linelength
21
// compile-flags:-Zprint-mono-items=eager
32

43
#![deny(dead_code)]

src/test/codegen-units/item-collection/cross-crate-trait-method.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// ignore-tidy-linelength
21
// compile-flags:-Zprint-mono-items=eager
32

43
#![deny(dead_code)]

src/test/codegen-units/item-collection/function-as-argument.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// ignore-tidy-linelength
21
// compile-flags:-Zprint-mono-items=eager
32

43
#![deny(dead_code)]

src/test/codegen-units/item-collection/generic-functions.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// ignore-tidy-linelength
21
// compile-flags:-Zprint-mono-items=eager
32

43
#![deny(dead_code)]

src/test/codegen-units/item-collection/generic-impl.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// ignore-tidy-linelength
21
// compile-flags:-Zprint-mono-items=eager
32

43
#![deny(dead_code)]

src/test/codegen-units/item-collection/impl-in-non-instantiated-generic.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// ignore-tidy-linelength
21
// compile-flags:-Zprint-mono-items=eager
32

43
#![deny(dead_code)]

src/test/codegen-units/item-collection/items-within-generic-items.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// ignore-tidy-linelength
21
// compile-flags:-Zprint-mono-items=eager
32

43
#![deny(dead_code)]

src/test/codegen-units/item-collection/non-generic-functions.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// ignore-tidy-linelength
21
// compile-flags:-Zprint-mono-items=eager
32

43
#![deny(dead_code)]

src/test/codegen-units/item-collection/overloaded-operators.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// ignore-tidy-linelength
21
// compile-flags:-Zprint-mono-items=eager
32

43
#![deny(dead_code)]

src/test/codegen-units/item-collection/static-init.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// compile-flags:-Zprint-mono-items=eager
2-
// ignore-tidy-linelength
32

43
#![feature(start)]
54

src/test/codegen-units/item-collection/statics-and-consts.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// ignore-tidy-linelength
21
// compile-flags:-Zprint-mono-items=eager
32

43
#![deny(dead_code)]

src/test/codegen-units/item-collection/trait-implementations.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// ignore-tidy-linelength
21
// compile-flags:-Zprint-mono-items=eager
32

43
#![deny(dead_code)]

src/test/codegen-units/item-collection/trait-method-as-argument.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// ignore-tidy-linelength
21
// compile-flags:-Zprint-mono-items=eager
32

43
#![deny(dead_code)]

src/test/codegen-units/item-collection/trait-method-default-impl.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// ignore-tidy-linelength
21
// compile-flags:-Zprint-mono-items=eager
32

43
#![deny(dead_code)]

src/test/codegen-units/item-collection/unreferenced-const-fn.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// ignore-tidy-linelength
21
// compile-flags:-Zprint-mono-items=lazy
32

43
#![deny(dead_code)]

src/test/codegen-units/item-collection/unreferenced-inline-function.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// ignore-tidy-linelength
21
// compile-flags:-Zprint-mono-items=lazy
32

43
// N.B., we do not expect *any* monomorphization to be generated here.

src/test/codegen-units/item-collection/unsizing.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// ignore-tidy-linelength
21
// compile-flags:-Zprint-mono-items=eager
32
// compile-flags:-Zinline-in-all-cgus
43

src/test/codegen-units/item-collection/unused-traits-and-generics.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// ignore-tidy-linelength
21
// compile-flags:-Zprint-mono-items=eager
32

43
#![crate_type="lib"]

src/test/codegen-units/partitioning/statics.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// ignore-tidy-linelength
21
// We specify -Z incremental here because we want to test the partitioning for
32
// incremental compilation
43
// compile-flags:-Zprint-mono-items=lazy -Zincremental=tmp/partitioning-tests/statics

src/test/codegen/adjustments.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// compile-flags: -C no-prepopulate-passes
2-
// ignore-tidy-linelength
32

43
#![crate_type = "lib"]
54

src/test/codegen/enum-debug-niche.rs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// before 7.0, then backported to the Rust LLVM fork. It tests that
33
// optimized enum debug info accurately reflects the enum layout.
44

5-
// ignore-tidy-linelength
65
// ignore-windows
76
// min-system-llvm-version 8.0
87

src/test/codegen/enum-debug-tagged.rs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// before 7.0, then backported to the Rust LLVM fork. It tests that
33
// debug info for tagged (ordinary) enums is properly emitted.
44

5-
// ignore-tidy-linelength
65
// ignore-windows
76
// min-system-llvm-version 8.0
87

src/test/codegen/generic-debug.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// ignore-tidy-linelength
21
// ignore-windows
32

43
// compile-flags: -g -C no-prepopulate-passes

src/test/codegen/mainsubprogram.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// This test depends on a patch that was committed to upstream LLVM
22
// before 4.0, formerly backported to the Rust LLVM fork.
33

4-
// ignore-tidy-linelength
54
// ignore-windows
65
// ignore-macos
76

src/test/codegen/mainsubprogramstart.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// ignore-tidy-linelength
21
// ignore-windows
32
// ignore-macos
43

src/test/codegen/noreturn-uninhabited.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// compile-flags: -g -C no-prepopulate-passes
2-
// ignore-tidy-linelength
32

43
#![crate_type = "lib"]
54

src/test/codegen/noreturnflag.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// compile-flags: -g -C no-prepopulate-passes
2-
// ignore-tidy-linelength
32

43
#![crate_type = "lib"]
54

src/test/codegen/panic-abort-windows.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// ignore-tidy-linelength
2-
31
// This test is for *-windows-msvc only.
42
// ignore-android
53
// ignore-bitrig

src/test/codegen/refs.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// compile-flags: -C no-prepopulate-passes
2-
// ignore-tidy-linelength
32

43
#![crate_type = "lib"]
54

src/test/codegen/remap_path_prefix/xcrate-generic.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// ignore-windows
2-
// ignore-tidy-linelength
32
// compile-flags: -g -C metadata=foo -C no-prepopulate-passes
43
// aux-build:xcrate-generic.rs
54

src/test/codegen/vtabletype.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// This test depends on a patch that was committed to upstream LLVM
22
// after 5.0, then backported to the Rust LLVM fork.
33

4-
// ignore-tidy-linelength
54
// ignore-windows
65
// ignore-macos
76

src/test/debuginfo/enum-thinlto.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// ignore-tidy-linelength
2-
31
// Require LLVM with DW_TAG_variant_part and a gdb that can read it.
42
// min-system-llvm-version: 8.0
53
// min-gdb-version: 8.2

src/test/debuginfo/generic-enum-with-different-disr-sizes.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// ignore-tidy-linelength
21
// ignore-lldb: FIXME(#27089)
32
// min-lldb-version: 310
43

src/test/debuginfo/recursive-struct.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// ignore-tidy-linelength
21
// ignore-lldb
32

43
// Require LLVM with DW_TAG_variant_part and a gdb that can read it.

src/test/debuginfo/unique-enum.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// ignore-tidy-linelength
2-
31
// Require LLVM with DW_TAG_variant_part and a gdb and lldb that can
42
// read it.
53
// min-system-llvm-version: 8.0

src/test/incremental/remapped_paths_cc/auxiliary/extern_crate.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// ignore-tidy-linelength
2-
31
//[rpass1] compile-flags: -g
42
//[rpass2] compile-flags: -g
53
//[rpass3] compile-flags: -g --remap-path-prefix={{src-base}}=/the/src

src/test/mir-opt/basic_assignment.rs

-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
// so subtle breakage in them can leave a quite hard-to-find trail of
66
// destruction.
77

8-
// ignore-tidy-linelength
9-
108
fn main() {
119
let nodrop_x = false;
1210
let nodrop_y;

src/test/mir-opt/nll/named-lifetimes-basic.rs

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
// compile-flags:-Zborrowck=mir -Zverbose
77
// ^^^^^^^^^ force compiler to dump more region information
8-
// ignore-tidy-linelength
98

109
#![allow(warnings)]
1110

src/test/mir-opt/storage_ranges.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// ignore-tidy-linelength
2-
31
fn main() {
42
let a = 0;
53
{

src/test/run-pass/issues/issue-16278.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
// this file has some special \r\n endings (use xxd to see them)
55

6-
fn main() {assert_eq!(b"", b"\
6+
fn main() {assert_eq!(b"", b"\
77
");
8-
assert_eq!(b"\n", b"
8+
assert_eq!(b"\n", b"
99
");
1010
}

src/test/rustdoc-ui/intra-link-span-ice-55723.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// ignore-tidy-end-whitespace
2-
31
#![deny(intra_doc_link_resolution_failure)]
42

53
// An error in calculating spans while reporting intra-doc link resolution errors caused rustdoc to

src/test/rustdoc-ui/intra-link-span-ice-55723.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error: `[i]` cannot be resolved, ignoring it...
2-
--> $DIR/intra-link-span-ice-55723.rs:11:10
2+
--> $DIR/intra-link-span-ice-55723.rs:9:10
33
|
44
LL | /// (arr[i])
55
| ^ cannot be resolved, ignoring
66
|
77
note: lint level defined here
8-
--> $DIR/intra-link-span-ice-55723.rs:3:9
8+
--> $DIR/intra-link-span-ice-55723.rs:1:9
99
|
1010
LL | #![deny(intra_doc_link_resolution_failure)]
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/test/rustdoc/empty-mod-private.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// ignore-tidy-linelength
21
// compile-flags: --document-private-items
32

43
// @has 'empty_mod_private/index.html' '//a[@href="foo/index.html"]' 'foo'

src/test/rustdoc/extern-html-root-url.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// ignore-tidy-linelength
2-
31
// compile-flags:-Z unstable-options --extern-html-root-url core=https://example.com/core/0.1.0
42

53
// @has extern_html_root_url/index.html

src/test/rustdoc/method-list.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// ignore-tidy-linelength
2-
31
#![crate_name = "foo"]
42

53
// @has foo/struct.Foo.html

src/test/rustdoc/pub-method.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// ignore-tidy-linelength
21
// compile-flags: --document-private-items
32

43
#![crate_name = "foo"]

src/test/ui/borrowck/two-phase-activation-sharing-interference.nll_target.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
2-
--> $DIR/two-phase-activation-sharing-interference.rs:32:15
2+
--> $DIR/two-phase-activation-sharing-interference.rs:30:15
33
|
44
LL | let y = &mut x;
55
| ------ mutable borrow occurs here
@@ -10,7 +10,7 @@ LL | *y += 1;
1010
| ------- mutable borrow later used here
1111

1212
error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
13-
--> $DIR/two-phase-activation-sharing-interference.rs:40:13
13+
--> $DIR/two-phase-activation-sharing-interference.rs:38:13
1414
|
1515
LL | let y = &mut x;
1616
| ------ mutable borrow occurs here
@@ -21,7 +21,7 @@ LL | *y += 1;
2121
| ------- mutable borrow later used here
2222

2323
error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
24-
--> $DIR/two-phase-activation-sharing-interference.rs:51:13
24+
--> $DIR/two-phase-activation-sharing-interference.rs:49:13
2525
|
2626
LL | let y = &mut x;
2727
| ------ mutable borrow occurs here
@@ -32,7 +32,7 @@ LL | *y += 1;
3232
| ------- mutable borrow later used here
3333

3434
error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
35-
--> $DIR/two-phase-activation-sharing-interference.rs:62:14
35+
--> $DIR/two-phase-activation-sharing-interference.rs:60:14
3636
|
3737
LL | let y = &mut x;
3838
| ------ mutable borrow occurs here

src/test/ui/borrowck/two-phase-activation-sharing-interference.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// ignore-tidy-linelength
2-
31
// revisions: nll_target
42

53
// The following revisions are disabled due to missing support from two-phase beyond autorefs

src/test/ui/consts/const-array-oob.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// ignore-tidy-linelength
2-
31
#![feature(const_indexing)]
42

53
const FOO: [usize; 3] = [1, 2, 3];

src/test/ui/consts/const-array-oob.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0080]: evaluation of constant value failed
2-
--> $DIR/const-array-oob.rs:8:19
2+
--> $DIR/const-array-oob.rs:6:19
33
|
44
LL | const BLUB: [u32; FOO[4]] = [5, 6];
55
| ^^^^^^ index out of bounds: the len is 3 but the index is 4

src/test/ui/deprecation/deprecation-in-future.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// ignore-tidy-linelength
2-
31
// run-pass
42

53
#![deny(deprecated_in_future)]

src/test/ui/deprecation/deprecation-in-future.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: use of deprecated item 'deprecated_future': text
2-
--> $DIR/deprecation-in-future.rs:11:5
2+
--> $DIR/deprecation-in-future.rs:9:5
33
|
44
LL | deprecated_future(); // ok; deprecated_in_future only applies to rustc_deprecated
55
| ^^^^^^^^^^^^^^^^^

src/test/ui/derives/deriving-meta-unknown-trait.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// ignore-tidy-linelength
2-
31
#[derive(Eqr)]
42
//~^ ERROR cannot find derive macro `Eqr` in this scope
53
struct Foo;

src/test/ui/derives/deriving-meta-unknown-trait.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: cannot find derive macro `Eqr` in this scope
2-
--> $DIR/deriving-meta-unknown-trait.rs:3:10
2+
--> $DIR/deriving-meta-unknown-trait.rs:1:10
33
|
44
LL | #[derive(Eqr)]
55
| ^^^ help: try: `Eq`

src/test/ui/discrim/discrim-overflow-2.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// ignore-tidy-linelength
2-
31
// Issue 23030: Detect overflowing discriminant
42
//
53
// Check that we detect the overflow even if enum is not used.

0 commit comments

Comments
 (0)