Skip to content

Commit

Permalink
Auto merge of #62910 - petrochenkov:buildwarn2, r=Mark-Simulacrum
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bors committed Jul 28, 2019
2 parents 023525d + 1a37010 commit 4560cb8
Show file tree
Hide file tree
Showing 127 changed files with 182 additions and 413 deletions.
3 changes: 2 additions & 1 deletion src/bootstrap/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
//! parent directory, and otherwise documentation can be found throughout the `build`
//! directory in each respective module.

#![deny(warnings)]
// NO-RUSTC-WRAPPER
#![deny(warnings, rust_2018_idioms, unused_lifetimes)]

use std::env;

Expand Down
6 changes: 5 additions & 1 deletion src/bootstrap/bin/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
//! switching compilers for the bootstrap and for build scripts will probably
//! never get replaced.

#![deny(warnings)]
// NO-RUSTC-WRAPPER
#![deny(warnings, rust_2018_idioms, unused_lifetimes)]

use std::env;
use std::ffi::OsString;
Expand Down Expand Up @@ -126,8 +127,11 @@ fn main() {

if env::var_os("RUSTC_DENY_WARNINGS").is_some() &&
env::var_os("RUSTC_EXTERNAL_TOOL").is_none() {
// When extending this list, search for `NO-RUSTC-WRAPPER` and add the new lints
// there as well, some code doesn't go through this `rustc` wrapper.
cmd.arg("-Dwarnings");
cmd.arg("-Drust_2018_idioms");
cmd.arg("-Dunused_lifetimes");
// cfg(not(bootstrap)): Remove this during the next stage 0 compiler update.
// `-Drustc::internal` is a new feature and `rustc_version` mis-reports the `stage`.
let cfg_not_bootstrap = stage != "0" && crate_name != Some("rustc_version");
Expand Down
3 changes: 2 additions & 1 deletion src/bootstrap/bin/rustdoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
//!
//! See comments in `src/bootstrap/rustc.rs` for more information.

#![deny(warnings)]
// NO-RUSTC-WRAPPER
#![deny(warnings, rust_2018_idioms, unused_lifetimes)]

use std::env;
use std::process::Command;
Expand Down
7 changes: 4 additions & 3 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,9 @@
//! More documentation can be found in each respective module below, and you can
//! also check out the `src/bootstrap/README.md` file for more information.

#![deny(rust_2018_idioms)]
#![deny(warnings)]
// NO-RUSTC-WRAPPER
#![deny(warnings, rust_2018_idioms, unused_lifetimes)]

#![feature(core_intrinsics)]
#![feature(drain_filter)]

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


impl<'a> Compiler {
impl Compiler {
pub fn with_stage(mut self, stage: u32) -> Compiler {
self.stage = stage;
self
Expand Down
3 changes: 2 additions & 1 deletion src/build_helper/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![deny(rust_2018_idioms)]
// NO-RUSTC-WRAPPER
#![deny(warnings, rust_2018_idioms, unused_lifetimes)]

use std::fs::File;
use std::path::{Path, PathBuf};
Expand Down
2 changes: 0 additions & 2 deletions src/liballoc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@
#![warn(missing_docs)]
#![warn(missing_debug_implementations)]
#![deny(intra_doc_link_resolution_failure)] // rustdoc is run without -D warnings

#![deny(rust_2018_idioms)]
#![allow(explicit_outlives_requirements)]

#![cfg_attr(not(test), feature(generator_trait))]
Expand Down
2 changes: 2 additions & 0 deletions src/liballoc/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1838,6 +1838,7 @@ impl PartialEq for String {
macro_rules! impl_eq {
($lhs:ty, $rhs: ty) => {
#[stable(feature = "rust1", since = "1.0.0")]
#[allow(unused_lifetimes)]
impl<'a, 'b> PartialEq<$rhs> for $lhs {
#[inline]
fn eq(&self, other: &$rhs) -> bool { PartialEq::eq(&self[..], &other[..]) }
Expand All @@ -1846,6 +1847,7 @@ macro_rules! impl_eq {
}

#[stable(feature = "rust1", since = "1.0.0")]
#[allow(unused_lifetimes)]
impl<'a, 'b> PartialEq<$lhs> for $rhs {
#[inline]
fn eq(&self, other: &$lhs) -> bool { PartialEq::eq(&self[..], &other[..]) }
Expand Down
1 change: 0 additions & 1 deletion src/liballoc/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#![feature(trusted_len)]
#![feature(try_reserve)]
#![feature(unboxed_closures)]
#![deny(rust_2018_idioms)]

use std::hash::{Hash, Hasher};
use std::collections::hash_map::DefaultHasher;
Expand Down
3 changes: 0 additions & 3 deletions src/libarena/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/",
test(no_crate_inject, attr(deny(warnings))))]

#![deny(rust_2018_idioms)]
#![deny(unused_lifetimes)]

#![feature(core_intrinsics)]
#![feature(dropck_eyepatch)]
#![feature(raw_vec_internals)]
Expand Down
14 changes: 7 additions & 7 deletions src/libcore/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ where
}

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

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

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

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

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

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

#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, 'b, A, B, const N: usize> PartialEq<[A; N]> for &'b mut [B]
impl<'b, A, B, const N: usize> PartialEq<[A; N]> for &'b mut [B]
where
B: PartialEq<A>,
[A; N]: LengthAtMost32,
Expand Down
2 changes: 0 additions & 2 deletions src/libcore/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@
#![warn(missing_docs)]
#![warn(missing_debug_implementations)]
#![deny(intra_doc_link_resolution_failure)] // rustdoc is run without -D warnings

#![deny(rust_2018_idioms)]
#![allow(explicit_outlives_requirements)]

#![feature(allow_internal_unstable)]
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/pin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ where
{}

#[stable(feature = "pin", since = "1.33.0")]
impl<'a, P, U> DispatchFromDyn<Pin<U>> for Pin<P>
impl<P, U> DispatchFromDyn<Pin<U>> for Pin<P>
where
P: DispatchFromDyn<U>,
{}
2 changes: 1 addition & 1 deletion src/libcore/ptr/unique.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ impl<T: ?Sized> From<&T> for Unique<T> {
}

#[unstable(feature = "ptr_internals", issue = "0")]
impl<'a, T: ?Sized> From<NonNull<T>> for Unique<T> {
impl<T: ?Sized> From<NonNull<T>> for Unique<T> {
#[inline]
fn from(p: NonNull<T>) -> Self {
unsafe { Unique::new_unchecked(p.as_ptr()) }
Expand Down
1 change: 0 additions & 1 deletion src/libcore/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#![feature(const_fn)]
#![feature(iter_partition_in_place)]
#![feature(iter_is_partitioned)]
#![warn(rust_2018_idioms)]

extern crate test;

Expand Down
3 changes: 0 additions & 3 deletions src/libfmt_macros/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
html_playground_url = "https://play.rust-lang.org/",
test(attr(deny(warnings))))]

#![deny(rust_2018_idioms)]
#![deny(unused_lifetimes)]

#![feature(nll)]
#![feature(rustc_private)]
#![feature(unicode_internals)]
Expand Down
2 changes: 0 additions & 2 deletions src/libgraphviz/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,6 @@
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/",
test(attr(allow(unused_variables), deny(warnings))))]

#![deny(rust_2018_idioms)]

#![feature(nll)]

use LabelText::*;
Expand Down
1 change: 0 additions & 1 deletion src/libpanic_abort/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#![panic_runtime]

#![allow(unused_features)]
#![deny(rust_2018_idioms)]

#![feature(core_intrinsics)]
#![feature(libc)]
Expand Down
2 changes: 0 additions & 2 deletions src/libpanic_unwind/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/",
issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/")]

#![deny(rust_2018_idioms)]

#![feature(core_intrinsics)]
#![feature(lang_items)]
#![feature(libc)]
Expand Down
1 change: 1 addition & 0 deletions src/libproc_macro/bridge/scoped_cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use std::mem;
use std::ops::{Deref, DerefMut};

/// Type lambda application, with a lifetime.
#[allow(unused_lifetimes)]
pub trait ApplyL<'a> {
type Out;
}
Expand Down
2 changes: 0 additions & 2 deletions src/libproc_macro/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
test(no_crate_inject, attr(deny(warnings))),
test(attr(allow(dead_code, deprecated, unused_variables, unused_mut))))]

#![deny(rust_2018_idioms)]

#![feature(nll)]
#![feature(staged_api)]
#![feature(const_fn)]
Expand Down
1 change: 0 additions & 1 deletion src/libprofiler_builtins/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@
#![allow(unused_features)]
#![feature(nll)]
#![feature(staged_api)]
#![deny(rust_2018_idioms)]
2 changes: 0 additions & 2 deletions src/librustc/error_codes.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(non_snake_case)]

// Error messages for EXXXX errors.
// Each message should start and end with a new line, and be wrapped to 80 characters.
// In vim you can `:set tw=80` and use `gq` to wrap paragraphs. Use `:set tw=0` to disable.
Expand Down
6 changes: 1 addition & 5 deletions src/librustc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@

#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]

#![deny(rust_2018_idioms)]
#![deny(unused_lifetimes)]

#![feature(arbitrary_self_types)]
#![feature(box_patterns)]
#![feature(box_syntax)]
Expand Down Expand Up @@ -81,8 +78,7 @@ extern crate libc;

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

#[macro_use]
mod macros;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/session/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1628,7 +1628,7 @@ impl RustcOptGroup {
// *unstable* options, i.e., options that are only enabled when the
// user also passes the `-Z unstable-options` debugging flag.
mod opt {
// The `fn opt_u` etc below are written so that we can use them
// The `fn flag*` etc below are written so that we can use them
// in the future; do not warn about them not being used right now.
#![allow(dead_code)]

Expand Down
Loading

0 comments on commit 4560cb8

Please sign in to comment.