about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-08-06 02:07:01 +0000
committerbors <bors@rust-lang.org>2021-08-06 02:07:01 +0000
commit7129033b429d75709d71fb6bf66c0cce2fec77c1 (patch)
tree777da77297e143c175425b5b1154636736e939e7
parente2f79572fbcbe103346c950d95d7335f6c804d83 (diff)
parent3171bd5bf54fb91f7f7df7c40df5adc7d8bd5dea (diff)
downloadrust-7129033b429d75709d71fb6bf66c0cce2fec77c1.tar.gz
rust-7129033b429d75709d71fb6bf66c0cce2fec77c1.zip
Auto merge of #87462 - ibraheemdev:tidy-file-length-ignore-comment, r=Mark-Simulacrum
Ignore comments in tidy-filelength

Ref https://github.com/rust-lang/rust/issues/60302#issuecomment-652402127
-rw-r--r--compiler/rustc_hir/src/hir.rs1
-rw-r--r--compiler/rustc_lint/src/builtin.rs2
-rw-r--r--compiler/rustc_lint_defs/src/builtin.rs2
-rw-r--r--compiler/rustc_middle/src/ty/layout.rs1
-rw-r--r--compiler/rustc_typeck/src/collect.rs3
-rw-r--r--library/core/src/iter/traits/iterator.rs4
-rw-r--r--library/core/src/slice/iter.rs1
-rw-r--r--library/core/src/slice/mod.rs2
-rw-r--r--library/std/src/collections/hash/map.rs2
-rw-r--r--src/tools/tidy/src/style.rs5
10 files changed, 4 insertions, 19 deletions
diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs
index aac5d296f17..fe1d190b4ec 100644
--- a/compiler/rustc_hir/src/hir.rs
+++ b/compiler/rustc_hir/src/hir.rs
@@ -1,4 +1,3 @@
-// ignore-tidy-filelength
 use crate::def::{CtorKind, DefKind, Res};
 use crate::def_id::{DefId, CRATE_DEF_ID};
 crate use crate::hir_id::{HirId, ItemLocalId};
diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs
index c590cd00bd5..f341ca68659 100644
--- a/compiler/rustc_lint/src/builtin.rs
+++ b/compiler/rustc_lint/src/builtin.rs
@@ -1,5 +1,3 @@
-// ignore-tidy-filelength
-
 //! Lints in the Rust compiler.
 //!
 //! This contains lints which can feasibly be implemented as their own
diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs
index 9b1ee53df23..8376734166b 100644
--- a/compiler/rustc_lint_defs/src/builtin.rs
+++ b/compiler/rustc_lint_defs/src/builtin.rs
@@ -1,5 +1,3 @@
-// ignore-tidy-filelength
-
 //! Some lints that are built in to the compiler.
 //!
 //! These are the built-in lints that are emitted direct in the main
diff --git a/compiler/rustc_middle/src/ty/layout.rs b/compiler/rustc_middle/src/ty/layout.rs
index 2e4395cfca8..423f3faf21f 100644
--- a/compiler/rustc_middle/src/ty/layout.rs
+++ b/compiler/rustc_middle/src/ty/layout.rs
@@ -1,4 +1,3 @@
-// ignore-tidy-filelength
 use crate::ich::StableHashingContext;
 use crate::middle::codegen_fn_attrs::CodegenFnAttrFlags;
 use crate::mir::{GeneratorLayout, GeneratorSavedLocal};
diff --git a/compiler/rustc_typeck/src/collect.rs b/compiler/rustc_typeck/src/collect.rs
index 06cb33b9ebf..eb94fde2109 100644
--- a/compiler/rustc_typeck/src/collect.rs
+++ b/compiler/rustc_typeck/src/collect.rs
@@ -1,4 +1,3 @@
-// ignore-tidy-filelength
 //! "Collection" is the process of determining the type and other external
 //! details of each item in Rust. Collection is specifically concerned
 //! with *inter-procedural* things -- for example, for a function
@@ -15,8 +14,6 @@
 //! At present, however, we do run collection across all items in the
 //! crate as a kind of pass. This should eventually be factored away.
 
-// ignore-tidy-filelength
-
 use crate::astconv::{AstConv, SizedByDefault};
 use crate::bounds::Bounds;
 use crate::check::intrinsic::intrinsic_operation_unsafety;
diff --git a/library/core/src/iter/traits/iterator.rs b/library/core/src/iter/traits/iterator.rs
index 537e42f66de..c199b068cbb 100644
--- a/library/core/src/iter/traits/iterator.rs
+++ b/library/core/src/iter/traits/iterator.rs
@@ -1,7 +1,3 @@
-// ignore-tidy-filelength
-// This file almost exclusively consists of the definition of `Iterator`. We
-// can't split that into multiple files.
-
 use crate::cmp::{self, Ordering};
 use crate::ops::{ControlFlow, Try};
 
diff --git a/library/core/src/slice/iter.rs b/library/core/src/slice/iter.rs
index 419bf0e292a..d67af9cf668 100644
--- a/library/core/src/slice/iter.rs
+++ b/library/core/src/slice/iter.rs
@@ -1,4 +1,3 @@
-// ignore-tidy-filelength
 //! Definitions of a bunch of iterators for `[T]`.
 
 #[macro_use] // import iterator! and forward_iterator!
diff --git a/library/core/src/slice/mod.rs b/library/core/src/slice/mod.rs
index 67eecab99d8..51227d54115 100644
--- a/library/core/src/slice/mod.rs
+++ b/library/core/src/slice/mod.rs
@@ -1,5 +1,3 @@
-// ignore-tidy-filelength
-
 //! Slice management and manipulation.
 //!
 //! For more details see [`std::slice`].
diff --git a/library/std/src/collections/hash/map.rs b/library/std/src/collections/hash/map.rs
index 933d686521e..1628e1bceda 100644
--- a/library/std/src/collections/hash/map.rs
+++ b/library/std/src/collections/hash/map.rs
@@ -1,5 +1,3 @@
-// ignore-tidy-filelength
-
 #[cfg(test)]
 mod tests;
 
diff --git a/src/tools/tidy/src/style.rs b/src/tools/tidy/src/style.rs
index 15ed2f7a0a9..d8d3dc3ddb1 100644
--- a/src/tools/tidy/src/style.rs
+++ b/src/tools/tidy/src/style.rs
@@ -344,7 +344,10 @@ pub fn check(path: &Path, bad: &mut bool) {
             } else {
                 trailing_new_lines = 0;
             }
-            lines = i;
+
+            if !line.trim().starts_with("//") {
+                lines += 1;
+            }
         }
         if leading_new_lines {
             tidy_error!(bad, "{}: leading newline", file.display());