Skip to content

Commit

Permalink
Rollup merge of rust-lang#60169 - varkor:tidy-unnecessary-ignore-newl…
Browse files Browse the repository at this point in the history
…ine, 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.
  • Loading branch information
Centril authored Apr 23, 2019
2 parents 22f96d4 + 5ab5806 commit 345d0be
Show file tree
Hide file tree
Showing 114 changed files with 182 additions and 250 deletions.
1 change: 0 additions & 1 deletion src/ci/docker/dist-various-1/install-x86_64-redox.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env bash
# ignore-tidy-linelength

set -ex

Expand Down
2 changes: 0 additions & 2 deletions src/ci/docker/dist-various-2/build-fuchsia-toolchain.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/usr/bin/env bash

# ignore-tidy-linelength

set -ex
source shared.sh

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// ignoring this test until MIR codegen has taken over completely
// ignore-test

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

#![deny(dead_code)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// ignore-tidy-linelength
// compile-flags:-Zprint-mono-items=eager

#![deny(dead_code)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// ignore-tidy-linelength
// compile-flags:-Zprint-mono-items=eager

#![deny(dead_code)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// ignore-tidy-linelength
// compile-flags:-Zprint-mono-items=eager

#![deny(dead_code)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// ignore-tidy-linelength
// compile-flags:-Zprint-mono-items=eager

#![deny(dead_code)]
Expand Down
1 change: 0 additions & 1 deletion src/test/codegen-units/item-collection/generic-impl.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// ignore-tidy-linelength
// compile-flags:-Zprint-mono-items=eager

#![deny(dead_code)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// ignore-tidy-linelength
// compile-flags:-Zprint-mono-items=eager

#![deny(dead_code)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// ignore-tidy-linelength
// compile-flags:-Zprint-mono-items=eager

#![deny(dead_code)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// ignore-tidy-linelength
// compile-flags:-Zprint-mono-items=eager

#![deny(dead_code)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// ignore-tidy-linelength
// compile-flags:-Zprint-mono-items=eager

#![deny(dead_code)]
Expand Down
1 change: 0 additions & 1 deletion src/test/codegen-units/item-collection/static-init.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// compile-flags:-Zprint-mono-items=eager
// ignore-tidy-linelength

#![feature(start)]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// ignore-tidy-linelength
// compile-flags:-Zprint-mono-items=eager

#![deny(dead_code)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// ignore-tidy-linelength
// compile-flags:-Zprint-mono-items=eager

#![deny(dead_code)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// ignore-tidy-linelength
// compile-flags:-Zprint-mono-items=eager

#![deny(dead_code)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// ignore-tidy-linelength
// compile-flags:-Zprint-mono-items=eager

#![deny(dead_code)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// ignore-tidy-linelength
// compile-flags:-Zprint-mono-items=lazy

#![deny(dead_code)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// ignore-tidy-linelength
// compile-flags:-Zprint-mono-items=lazy

// N.B., we do not expect *any* monomorphization to be generated here.
Expand Down
1 change: 0 additions & 1 deletion src/test/codegen-units/item-collection/unsizing.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// ignore-tidy-linelength
// compile-flags:-Zprint-mono-items=eager
// compile-flags:-Zinline-in-all-cgus

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// ignore-tidy-linelength
// compile-flags:-Zprint-mono-items=eager

#![crate_type="lib"]
Expand Down
1 change: 0 additions & 1 deletion src/test/codegen-units/partitioning/statics.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// ignore-tidy-linelength
// We specify -Z incremental here because we want to test the partitioning for
// incremental compilation
// compile-flags:-Zprint-mono-items=lazy -Zincremental=tmp/partitioning-tests/statics
Expand Down
1 change: 0 additions & 1 deletion src/test/codegen/adjustments.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// compile-flags: -C no-prepopulate-passes
// ignore-tidy-linelength

#![crate_type = "lib"]

Expand Down
1 change: 0 additions & 1 deletion src/test/codegen/enum-debug-niche.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// before 7.0, then backported to the Rust LLVM fork. It tests that
// optimized enum debug info accurately reflects the enum layout.

// ignore-tidy-linelength
// ignore-windows
// min-system-llvm-version 8.0

Expand Down
1 change: 0 additions & 1 deletion src/test/codegen/enum-debug-tagged.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// before 7.0, then backported to the Rust LLVM fork. It tests that
// debug info for tagged (ordinary) enums is properly emitted.

// ignore-tidy-linelength
// ignore-windows
// min-system-llvm-version 8.0

Expand Down
1 change: 0 additions & 1 deletion src/test/codegen/generic-debug.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// ignore-tidy-linelength
// ignore-windows

// compile-flags: -g -C no-prepopulate-passes
Expand Down
1 change: 0 additions & 1 deletion src/test/codegen/mainsubprogram.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// This test depends on a patch that was committed to upstream LLVM
// before 4.0, formerly backported to the Rust LLVM fork.

// ignore-tidy-linelength
// ignore-windows
// ignore-macos

Expand Down
1 change: 0 additions & 1 deletion src/test/codegen/mainsubprogramstart.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// ignore-tidy-linelength
// ignore-windows
// ignore-macos

Expand Down
1 change: 0 additions & 1 deletion src/test/codegen/noreturn-uninhabited.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// compile-flags: -g -C no-prepopulate-passes
// ignore-tidy-linelength

#![crate_type = "lib"]

Expand Down
1 change: 0 additions & 1 deletion src/test/codegen/noreturnflag.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// compile-flags: -g -C no-prepopulate-passes
// ignore-tidy-linelength

#![crate_type = "lib"]

Expand Down
2 changes: 0 additions & 2 deletions src/test/codegen/panic-abort-windows.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// ignore-tidy-linelength

// This test is for *-windows-msvc only.
// ignore-android
// ignore-bitrig
Expand Down
1 change: 0 additions & 1 deletion src/test/codegen/refs.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// compile-flags: -C no-prepopulate-passes
// ignore-tidy-linelength

#![crate_type = "lib"]

Expand Down
1 change: 0 additions & 1 deletion src/test/codegen/remap_path_prefix/xcrate-generic.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// ignore-windows
// ignore-tidy-linelength
// compile-flags: -g -C metadata=foo -C no-prepopulate-passes
// aux-build:xcrate-generic.rs

Expand Down
1 change: 0 additions & 1 deletion src/test/codegen/vtabletype.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// This test depends on a patch that was committed to upstream LLVM
// after 5.0, then backported to the Rust LLVM fork.

// ignore-tidy-linelength
// ignore-windows
// ignore-macos

Expand Down
2 changes: 0 additions & 2 deletions src/test/debuginfo/enum-thinlto.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// ignore-tidy-linelength

// Require LLVM with DW_TAG_variant_part and a gdb that can read it.
// min-system-llvm-version: 8.0
// min-gdb-version: 8.2
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// ignore-tidy-linelength
// ignore-lldb: FIXME(#27089)
// min-lldb-version: 310

Expand Down
1 change: 0 additions & 1 deletion src/test/debuginfo/recursive-struct.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// ignore-tidy-linelength
// ignore-lldb

// Require LLVM with DW_TAG_variant_part and a gdb that can read it.
Expand Down
2 changes: 0 additions & 2 deletions src/test/debuginfo/unique-enum.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// ignore-tidy-linelength

// Require LLVM with DW_TAG_variant_part and a gdb and lldb that can
// read it.
// min-system-llvm-version: 8.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// ignore-tidy-linelength

//[rpass1] compile-flags: -g
//[rpass2] compile-flags: -g
//[rpass3] compile-flags: -g --remap-path-prefix={{src-base}}=/the/src
Expand Down
2 changes: 0 additions & 2 deletions src/test/mir-opt/basic_assignment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
// so subtle breakage in them can leave a quite hard-to-find trail of
// destruction.

// ignore-tidy-linelength

fn main() {
let nodrop_x = false;
let nodrop_y;
Expand Down
1 change: 0 additions & 1 deletion src/test/mir-opt/nll/named-lifetimes-basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

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

#![allow(warnings)]

Expand Down
2 changes: 0 additions & 2 deletions src/test/mir-opt/storage_ranges.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// ignore-tidy-linelength

fn main() {
let a = 0;
{
Expand Down
4 changes: 2 additions & 2 deletions src/test/run-pass/issues/issue-16278.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

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

fn main() {assert_eq!(b"", b"\
fn main() {assert_eq!(b"", b"\
");
assert_eq!(b"\n", b"
assert_eq!(b"\n", b"
");
}
2 changes: 0 additions & 2 deletions src/test/rustdoc-ui/intra-link-span-ice-55723.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// ignore-tidy-end-whitespace

#![deny(intra_doc_link_resolution_failure)]

// An error in calculating spans while reporting intra-doc link resolution errors caused rustdoc to
Expand Down
4 changes: 2 additions & 2 deletions src/test/rustdoc-ui/intra-link-span-ice-55723.stderr
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
error: `[i]` cannot be resolved, ignoring it...
--> $DIR/intra-link-span-ice-55723.rs:11:10
--> $DIR/intra-link-span-ice-55723.rs:9:10
|
LL | /// (arr[i])
| ^ cannot be resolved, ignoring
|
note: lint level defined here
--> $DIR/intra-link-span-ice-55723.rs:3:9
--> $DIR/intra-link-span-ice-55723.rs:1:9
|
LL | #![deny(intra_doc_link_resolution_failure)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
1 change: 0 additions & 1 deletion src/test/rustdoc/empty-mod-private.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// ignore-tidy-linelength
// compile-flags: --document-private-items

// @has 'empty_mod_private/index.html' '//a[@href="foo/index.html"]' 'foo'
Expand Down
2 changes: 0 additions & 2 deletions src/test/rustdoc/extern-html-root-url.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// ignore-tidy-linelength

// compile-flags:-Z unstable-options --extern-html-root-url core=https://example.com/core/0.1.0

// @has extern_html_root_url/index.html
Expand Down
2 changes: 0 additions & 2 deletions src/test/rustdoc/method-list.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// ignore-tidy-linelength

#![crate_name = "foo"]

// @has foo/struct.Foo.html
Expand Down
1 change: 0 additions & 1 deletion src/test/rustdoc/pub-method.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// ignore-tidy-linelength
// compile-flags: --document-private-items

#![crate_name = "foo"]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
--> $DIR/two-phase-activation-sharing-interference.rs:32:15
--> $DIR/two-phase-activation-sharing-interference.rs:30:15
|
LL | let y = &mut x;
| ------ mutable borrow occurs here
Expand All @@ -10,7 +10,7 @@ LL | *y += 1;
| ------- mutable borrow later used here

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

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

error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
--> $DIR/two-phase-activation-sharing-interference.rs:62:14
--> $DIR/two-phase-activation-sharing-interference.rs:60:14
|
LL | let y = &mut x;
| ------ mutable borrow occurs here
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// ignore-tidy-linelength

// revisions: nll_target

// The following revisions are disabled due to missing support from two-phase beyond autorefs
Expand Down
2 changes: 0 additions & 2 deletions src/test/ui/consts/const-array-oob.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// ignore-tidy-linelength

#![feature(const_indexing)]

const FOO: [usize; 3] = [1, 2, 3];
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/consts/const-array-oob.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0080]: evaluation of constant value failed
--> $DIR/const-array-oob.rs:8:19
--> $DIR/const-array-oob.rs:6:19
|
LL | const BLUB: [u32; FOO[4]] = [5, 6];
| ^^^^^^ index out of bounds: the len is 3 but the index is 4
Expand Down
2 changes: 0 additions & 2 deletions src/test/ui/deprecation/deprecation-in-future.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// ignore-tidy-linelength

// run-pass

#![deny(deprecated_in_future)]
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/deprecation/deprecation-in-future.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
warning: use of deprecated item 'deprecated_future': text
--> $DIR/deprecation-in-future.rs:11:5
--> $DIR/deprecation-in-future.rs:9:5
|
LL | deprecated_future(); // ok; deprecated_in_future only applies to rustc_deprecated
| ^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 0 additions & 2 deletions src/test/ui/derives/deriving-meta-unknown-trait.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// ignore-tidy-linelength

#[derive(Eqr)]
//~^ ERROR cannot find derive macro `Eqr` in this scope
struct Foo;
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/derives/deriving-meta-unknown-trait.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: cannot find derive macro `Eqr` in this scope
--> $DIR/deriving-meta-unknown-trait.rs:3:10
--> $DIR/deriving-meta-unknown-trait.rs:1:10
|
LL | #[derive(Eqr)]
| ^^^ help: try: `Eq`
Expand Down
2 changes: 0 additions & 2 deletions src/test/ui/discrim/discrim-overflow-2.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// ignore-tidy-linelength

// Issue 23030: Detect overflowing discriminant
//
// Check that we detect the overflow even if enum is not used.
Expand Down
Loading

0 comments on commit 345d0be

Please sign in to comment.