Skip to content

Commit 4560cb8

Browse files
committed
Auto merge of #62910 - petrochenkov:buildwarn2, r=Mark-Simulacrum
cleanup: Remove lint annotations in specific crates that are already enforced by rustbuild Remove some random unnecessary lint `allow`s. Deny `unused_lifetimes` through rustbuild. r? @Mark-Simulacrum
2 parents 023525d + 1a37010 commit 4560cb8

File tree

127 files changed

+182
-413
lines changed

Some content is hidden

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

127 files changed

+182
-413
lines changed

src/bootstrap/bin/main.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
//! parent directory, and otherwise documentation can be found throughout the `build`
66
//! directory in each respective module.
77
8-
#![deny(warnings)]
8+
// NO-RUSTC-WRAPPER
9+
#![deny(warnings, rust_2018_idioms, unused_lifetimes)]
910

1011
use std::env;
1112

src/bootstrap/bin/rustc.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
//! switching compilers for the bootstrap and for build scripts will probably
1616
//! never get replaced.
1717
18-
#![deny(warnings)]
18+
// NO-RUSTC-WRAPPER
19+
#![deny(warnings, rust_2018_idioms, unused_lifetimes)]
1920

2021
use std::env;
2122
use std::ffi::OsString;
@@ -126,8 +127,11 @@ fn main() {
126127

127128
if env::var_os("RUSTC_DENY_WARNINGS").is_some() &&
128129
env::var_os("RUSTC_EXTERNAL_TOOL").is_none() {
130+
// When extending this list, search for `NO-RUSTC-WRAPPER` and add the new lints
131+
// there as well, some code doesn't go through this `rustc` wrapper.
129132
cmd.arg("-Dwarnings");
130133
cmd.arg("-Drust_2018_idioms");
134+
cmd.arg("-Dunused_lifetimes");
131135
// cfg(not(bootstrap)): Remove this during the next stage 0 compiler update.
132136
// `-Drustc::internal` is a new feature and `rustc_version` mis-reports the `stage`.
133137
let cfg_not_bootstrap = stage != "0" && crate_name != Some("rustc_version");

src/bootstrap/bin/rustdoc.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
//!
33
//! See comments in `src/bootstrap/rustc.rs` for more information.
44
5-
#![deny(warnings)]
5+
// NO-RUSTC-WRAPPER
6+
#![deny(warnings, rust_2018_idioms, unused_lifetimes)]
67

78
use std::env;
89
use std::process::Command;

src/bootstrap/lib.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,9 @@
103103
//! More documentation can be found in each respective module below, and you can
104104
//! also check out the `src/bootstrap/README.md` file for more information.
105105
106-
#![deny(rust_2018_idioms)]
107-
#![deny(warnings)]
106+
// NO-RUSTC-WRAPPER
107+
#![deny(warnings, rust_2018_idioms, unused_lifetimes)]
108+
108109
#![feature(core_intrinsics)]
109110
#![feature(drain_filter)]
110111

@@ -1312,7 +1313,7 @@ fn chmod(path: &Path, perms: u32) {
13121313
fn chmod(_path: &Path, _perms: u32) {}
13131314

13141315

1315-
impl<'a> Compiler {
1316+
impl Compiler {
13161317
pub fn with_stage(mut self, stage: u32) -> Compiler {
13171318
self.stage = stage;
13181319
self

src/build_helper/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
#![deny(rust_2018_idioms)]
1+
// NO-RUSTC-WRAPPER
2+
#![deny(warnings, rust_2018_idioms, unused_lifetimes)]
23

34
use std::fs::File;
45
use std::path::{Path, PathBuf};

src/liballoc/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@
6262
#![warn(missing_docs)]
6363
#![warn(missing_debug_implementations)]
6464
#![deny(intra_doc_link_resolution_failure)] // rustdoc is run without -D warnings
65-
66-
#![deny(rust_2018_idioms)]
6765
#![allow(explicit_outlives_requirements)]
6866

6967
#![cfg_attr(not(test), feature(generator_trait))]

src/liballoc/string.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1838,6 +1838,7 @@ impl PartialEq for String {
18381838
macro_rules! impl_eq {
18391839
($lhs:ty, $rhs: ty) => {
18401840
#[stable(feature = "rust1", since = "1.0.0")]
1841+
#[allow(unused_lifetimes)]
18411842
impl<'a, 'b> PartialEq<$rhs> for $lhs {
18421843
#[inline]
18431844
fn eq(&self, other: &$rhs) -> bool { PartialEq::eq(&self[..], &other[..]) }
@@ -1846,6 +1847,7 @@ macro_rules! impl_eq {
18461847
}
18471848

18481849
#[stable(feature = "rust1", since = "1.0.0")]
1850+
#[allow(unused_lifetimes)]
18491851
impl<'a, 'b> PartialEq<$lhs> for $rhs {
18501852
#[inline]
18511853
fn eq(&self, other: &$lhs) -> bool { PartialEq::eq(&self[..], &other[..]) }

src/liballoc/tests/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#![feature(trusted_len)]
99
#![feature(try_reserve)]
1010
#![feature(unboxed_closures)]
11-
#![deny(rust_2018_idioms)]
1211

1312
use std::hash::{Hash, Hasher};
1413
use std::collections::hash_map::DefaultHasher;

src/libarena/lib.rs

-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
1111
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/",
1212
test(no_crate_inject, attr(deny(warnings))))]
1313

14-
#![deny(rust_2018_idioms)]
15-
#![deny(unused_lifetimes)]
16-
1714
#![feature(core_intrinsics)]
1815
#![feature(dropck_eyepatch)]
1916
#![feature(raw_vec_internals)]

src/libcore/array.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ where
217217
}
218218

219219
#[stable(feature = "rust1", since = "1.0.0")]
220-
impl<'a, 'b, A, B, const N: usize> PartialEq<[B; N]> for [A; N]
220+
impl<A, B, const N: usize> PartialEq<[B; N]> for [A; N]
221221
where
222222
A: PartialEq<B>,
223223
[A; N]: LengthAtMost32,
@@ -234,7 +234,7 @@ where
234234
}
235235

236236
#[stable(feature = "rust1", since = "1.0.0")]
237-
impl<'a, 'b, A, B, const N: usize> PartialEq<[B]> for [A; N]
237+
impl<A, B, const N: usize> PartialEq<[B]> for [A; N]
238238
where
239239
A: PartialEq<B>,
240240
[A; N]: LengthAtMost32,
@@ -250,7 +250,7 @@ where
250250
}
251251

252252
#[stable(feature = "rust1", since = "1.0.0")]
253-
impl<'a, 'b, A, B, const N: usize> PartialEq<[A; N]> for [B]
253+
impl<A, B, const N: usize> PartialEq<[A; N]> for [B]
254254
where
255255
B: PartialEq<A>,
256256
[A; N]: LengthAtMost32,
@@ -266,7 +266,7 @@ where
266266
}
267267

268268
#[stable(feature = "rust1", since = "1.0.0")]
269-
impl<'a, 'b, A, B, const N: usize> PartialEq<&'b [B]> for [A; N]
269+
impl<'b, A, B, const N: usize> PartialEq<&'b [B]> for [A; N]
270270
where
271271
A: PartialEq<B>,
272272
[A; N]: LengthAtMost32,
@@ -282,7 +282,7 @@ where
282282
}
283283

284284
#[stable(feature = "rust1", since = "1.0.0")]
285-
impl<'a, 'b, A, B, const N: usize> PartialEq<[A; N]> for &'b [B]
285+
impl<'b, A, B, const N: usize> PartialEq<[A; N]> for &'b [B]
286286
where
287287
B: PartialEq<A>,
288288
[A; N]: LengthAtMost32,
@@ -298,7 +298,7 @@ where
298298
}
299299

300300
#[stable(feature = "rust1", since = "1.0.0")]
301-
impl<'a, 'b, A, B, const N: usize> PartialEq<&'b mut [B]> for [A; N]
301+
impl<'b, A, B, const N: usize> PartialEq<&'b mut [B]> for [A; N]
302302
where
303303
A: PartialEq<B>,
304304
[A; N]: LengthAtMost32,
@@ -314,7 +314,7 @@ where
314314
}
315315

316316
#[stable(feature = "rust1", since = "1.0.0")]
317-
impl<'a, 'b, A, B, const N: usize> PartialEq<[A; N]> for &'b mut [B]
317+
impl<'b, A, B, const N: usize> PartialEq<[A; N]> for &'b mut [B]
318318
where
319319
B: PartialEq<A>,
320320
[A; N]: LengthAtMost32,

src/libcore/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@
6262
#![warn(missing_docs)]
6363
#![warn(missing_debug_implementations)]
6464
#![deny(intra_doc_link_resolution_failure)] // rustdoc is run without -D warnings
65-
66-
#![deny(rust_2018_idioms)]
6765
#![allow(explicit_outlives_requirements)]
6866

6967
#![feature(allow_internal_unstable)]

src/libcore/pin.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ where
775775
{}
776776

777777
#[stable(feature = "pin", since = "1.33.0")]
778-
impl<'a, P, U> DispatchFromDyn<Pin<U>> for Pin<P>
778+
impl<P, U> DispatchFromDyn<Pin<U>> for Pin<P>
779779
where
780780
P: DispatchFromDyn<U>,
781781
{}

src/libcore/ptr/unique.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ impl<T: ?Sized> From<&T> for Unique<T> {
172172
}
173173

174174
#[unstable(feature = "ptr_internals", issue = "0")]
175-
impl<'a, T: ?Sized> From<NonNull<T>> for Unique<T> {
175+
impl<T: ?Sized> From<NonNull<T>> for Unique<T> {
176176
#[inline]
177177
fn from(p: NonNull<T>) -> Self {
178178
unsafe { Unique::new_unchecked(p.as_ptr()) }

src/libcore/tests/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
#![feature(const_fn)]
3333
#![feature(iter_partition_in_place)]
3434
#![feature(iter_is_partitioned)]
35-
#![warn(rust_2018_idioms)]
3635

3736
extern crate test;
3837

src/libfmt_macros/lib.rs

-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
html_playground_url = "https://play.rust-lang.org/",
99
test(attr(deny(warnings))))]
1010

11-
#![deny(rust_2018_idioms)]
12-
#![deny(unused_lifetimes)]
13-
1411
#![feature(nll)]
1512
#![feature(rustc_private)]
1613
#![feature(unicode_internals)]

src/libgraphviz/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,6 @@
274274
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/",
275275
test(attr(allow(unused_variables), deny(warnings))))]
276276

277-
#![deny(rust_2018_idioms)]
278-
279277
#![feature(nll)]
280278

281279
use LabelText::*;

src/libpanic_abort/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#![panic_runtime]
1111

1212
#![allow(unused_features)]
13-
#![deny(rust_2018_idioms)]
1413

1514
#![feature(core_intrinsics)]
1615
#![feature(libc)]

src/libpanic_unwind/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/",
1818
issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/")]
1919

20-
#![deny(rust_2018_idioms)]
21-
2220
#![feature(core_intrinsics)]
2321
#![feature(lang_items)]
2422
#![feature(libc)]

src/libproc_macro/bridge/scoped_cell.rs

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use std::mem;
55
use std::ops::{Deref, DerefMut};
66

77
/// Type lambda application, with a lifetime.
8+
#[allow(unused_lifetimes)]
89
pub trait ApplyL<'a> {
910
type Out;
1011
}

src/libproc_macro/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
test(no_crate_inject, attr(deny(warnings))),
1818
test(attr(allow(dead_code, deprecated, unused_variables, unused_mut))))]
1919

20-
#![deny(rust_2018_idioms)]
21-
2220
#![feature(nll)]
2321
#![feature(staged_api)]
2422
#![feature(const_fn)]

src/libprofiler_builtins/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,3 @@
77
#![allow(unused_features)]
88
#![feature(nll)]
99
#![feature(staged_api)]
10-
#![deny(rust_2018_idioms)]

src/librustc/error_codes.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![allow(non_snake_case)]
2-
31
// Error messages for EXXXX errors.
42
// Each message should start and end with a new line, and be wrapped to 80 characters.
53
// In vim you can `:set tw=80` and use `gq` to wrap paragraphs. Use `:set tw=0` to disable.

src/librustc/lib.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@
2828
2929
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
3030

31-
#![deny(rust_2018_idioms)]
32-
#![deny(unused_lifetimes)]
33-
3431
#![feature(arbitrary_self_types)]
3532
#![feature(box_patterns)]
3633
#![feature(box_syntax)]
@@ -81,8 +78,7 @@ extern crate libc;
8178

8279
// Use the test crate here so we depend on getopts through it. This allow tools to link to both
8380
// librustc_driver and libtest.
84-
#[allow(unused_extern_crates)]
85-
extern crate test;
81+
extern crate test as _;
8682

8783
#[macro_use]
8884
mod macros;

src/librustc/session/config.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1628,7 +1628,7 @@ impl RustcOptGroup {
16281628
// *unstable* options, i.e., options that are only enabled when the
16291629
// user also passes the `-Z unstable-options` debugging flag.
16301630
mod opt {
1631-
// The `fn opt_u` etc below are written so that we can use them
1631+
// The `fn flag*` etc below are written so that we can use them
16321632
// in the future; do not warn about them not being used right now.
16331633
#![allow(dead_code)]
16341634

0 commit comments

Comments
 (0)