From 3171bd5bf54fb91f7f7df7c40df5adc7d8bd5dea Mon Sep 17 00:00:00 2001 From: ibraheemdev Date: Sun, 25 Jul 2021 17:10:51 -0400 Subject: [PATCH] ignore comments in tidy-filelength --- compiler/rustc_hir/src/hir.rs | 1 - compiler/rustc_lint/src/builtin.rs | 2 -- compiler/rustc_lint_defs/src/builtin.rs | 2 -- compiler/rustc_middle/src/ty/layout.rs | 1 - compiler/rustc_typeck/src/collect.rs | 3 --- library/core/src/iter/traits/iterator.rs | 4 ---- library/core/src/slice/iter.rs | 1 - library/core/src/slice/mod.rs | 2 -- library/std/src/collections/hash/map.rs | 2 -- src/tools/tidy/src/style.rs | 5 ++++- 10 files changed, 4 insertions(+), 19 deletions(-) diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index 389d1e5899f70..0e9375a0e4d13 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 b3c64b76820f1..8394eaaa03f18 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 5b1cd0bcb3ffe..07074a6bac169 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 95ea38d32b695..1b7d10485e454 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 46b3ec5cf40c7..9da3daf82f7c3 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 16efd2f0eaff9..7fc49574de9ee 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 5cbc6343e3a77..e7507dd85c1b2 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 de25c984abf90..19e1aeca916f6 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 b102fd9d5bfdc..fe9dd571c3a23 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 15ed2f7a0a975..d8d3dc3ddb1e5 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());