mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 21:23:56 +00:00
Remove some miscellaneous #[allow]
s
This commit is contained in:
parent
834b691a9f
commit
943a8e0646
9 changed files with 10 additions and 43 deletions
|
@ -1,5 +1,3 @@
|
|||
use std::ffi::OsStr;
|
||||
use std::num::ParseIntError;
|
||||
use std::path::Path;
|
||||
use std::process::Command;
|
||||
use std::time::{Duration, SystemTime};
|
||||
|
@ -58,8 +56,3 @@ fn mtime(path: impl AsRef<Path>) -> SystemTime {
|
|||
.unwrap_or(SystemTime::UNIX_EPOCH)
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::missing_errors_doc)]
|
||||
pub fn validate_port(arg: &OsStr) -> Result<(), ParseIntError> {
|
||||
arg.to_string_lossy().parse::<u16>().map(|_| ())
|
||||
}
|
||||
|
|
|
@ -55,7 +55,6 @@ impl IncompatibleMsrv {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::cast_lossless)]
|
||||
fn get_def_id_version(&mut self, tcx: TyCtxt<'_>, def_id: DefId) -> RustcVersion {
|
||||
if let Some(version) = self.is_above_msrv.get(&def_id) {
|
||||
return *version;
|
||||
|
@ -67,9 +66,9 @@ impl IncompatibleMsrv {
|
|||
since: StableSince::Version(version),
|
||||
..
|
||||
} => Some(RustcVersion::new(
|
||||
version.major as _,
|
||||
version.minor as _,
|
||||
version.patch as _,
|
||||
version.major.into(),
|
||||
version.minor.into(),
|
||||
version.patch.into(),
|
||||
)),
|
||||
_ => None,
|
||||
}) {
|
||||
|
|
|
@ -70,8 +70,6 @@ declare_clippy_lint! {
|
|||
///
|
||||
/// Use instead:
|
||||
/// ```no_run
|
||||
/// # #![allow(unused)]
|
||||
///
|
||||
/// # let x = vec![0; 5];
|
||||
/// # let y = [0, 1, 2, 3];
|
||||
/// x.get(2);
|
||||
|
|
|
@ -41,7 +41,6 @@ declare_clippy_lint! {
|
|||
/// ### Example
|
||||
/// ```no_run
|
||||
/// let infinite_iter = 0..;
|
||||
/// # #[allow(unused)]
|
||||
/// [0..].iter().zip(infinite_iter.take_while(|x| *x > 5));
|
||||
/// ```
|
||||
#[clippy::version = "pre 1.29.0"]
|
||||
|
|
|
@ -966,10 +966,3 @@ pub fn register_renamed(ls: &mut rustc_lint::LintStore) {
|
|||
ls.register_renamed(old_name, new_name);
|
||||
}
|
||||
}
|
||||
|
||||
// only exists to let the dogfood integration test works.
|
||||
// Don't run clippy as an executable directly
|
||||
#[allow(dead_code)]
|
||||
fn main() {
|
||||
panic!("Please use the cargo-clippy executable");
|
||||
}
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
#![allow(unused_imports)]
|
||||
|
||||
use super::ITER_KV_MAP;
|
||||
use clippy_config::msrvs::{self, Msrv};
|
||||
use clippy_utils::diagnostics::{multispan_sugg, span_lint_and_sugg, span_lint_and_then};
|
||||
use clippy_utils::source::{snippet, snippet_with_applicability};
|
||||
use clippy_utils::diagnostics::span_lint_and_sugg;
|
||||
use clippy_utils::pat_is_wild;
|
||||
use clippy_utils::source::snippet_with_applicability;
|
||||
use clippy_utils::ty::is_type_diagnostic_item;
|
||||
use clippy_utils::{pat_is_wild, sugg};
|
||||
use rustc_hir::{BindingMode, Body, BorrowKind, ByRef, Expr, ExprKind, Mutability, Pat, PatKind};
|
||||
use rustc_lint::{LateContext, LintContext};
|
||||
use rustc_middle::ty;
|
||||
use rustc_span::{sym, Span};
|
||||
use rustc_hir::{Body, Expr, ExprKind, PatKind};
|
||||
use rustc_lint::LateContext;
|
||||
use rustc_span::sym;
|
||||
|
||||
/// lint use of:
|
||||
///
|
||||
|
|
|
@ -749,7 +749,6 @@ declare_clippy_lint! {
|
|||
///
|
||||
/// ### Example
|
||||
/// ```no_run
|
||||
/// # #![allow(unused)]
|
||||
/// (0_i32..10)
|
||||
/// .filter(|n| n.checked_add(1).is_some())
|
||||
/// .map(|n| n.checked_add(1).unwrap());
|
||||
|
@ -757,7 +756,6 @@ declare_clippy_lint! {
|
|||
///
|
||||
/// Use instead:
|
||||
/// ```no_run
|
||||
/// # #[allow(unused)]
|
||||
/// (0_i32..10).filter_map(|n| n.checked_add(1));
|
||||
/// ```
|
||||
#[clippy::version = "1.51.0"]
|
||||
|
@ -850,7 +848,6 @@ declare_clippy_lint! {
|
|||
///
|
||||
/// ### Example
|
||||
/// ```no_run
|
||||
/// # #![allow(unused)]
|
||||
/// let vec = vec![1];
|
||||
/// vec.iter().find(|x| **x == 0).is_some();
|
||||
///
|
||||
|
@ -862,7 +859,6 @@ declare_clippy_lint! {
|
|||
/// let vec = vec![1];
|
||||
/// vec.iter().any(|x| *x == 0);
|
||||
///
|
||||
/// # #[allow(unused)]
|
||||
/// !"hello world".contains("world");
|
||||
/// ```
|
||||
#[clippy::version = "pre 1.29.0"]
|
||||
|
@ -1505,7 +1501,6 @@ declare_clippy_lint! {
|
|||
///
|
||||
/// ### Example
|
||||
/// ```no_run
|
||||
/// # #[allow(unused)]
|
||||
/// (0..3).fold(false, |acc, x| acc || x > 2);
|
||||
/// ```
|
||||
///
|
||||
|
@ -2008,13 +2003,11 @@ declare_clippy_lint! {
|
|||
///
|
||||
/// ### Example
|
||||
/// ```no_run
|
||||
/// # #[allow(unused)]
|
||||
/// "Hello".bytes().nth(3);
|
||||
/// ```
|
||||
///
|
||||
/// Use instead:
|
||||
/// ```no_run
|
||||
/// # #[allow(unused)]
|
||||
/// "Hello".as_bytes().get(3);
|
||||
/// ```
|
||||
#[clippy::version = "1.52.0"]
|
||||
|
@ -2059,7 +2052,6 @@ declare_clippy_lint! {
|
|||
///
|
||||
/// ### Example
|
||||
/// ```no_run
|
||||
/// # #![allow(unused)]
|
||||
/// let some_vec = vec![0, 1, 2, 3];
|
||||
///
|
||||
/// some_vec.iter().count();
|
||||
|
@ -3656,7 +3648,6 @@ declare_clippy_lint! {
|
|||
///
|
||||
/// ### Example
|
||||
/// ```no_run
|
||||
/// # #![allow(unused)]
|
||||
/// let owned_string = "This is a string".to_owned();
|
||||
/// owned_string.as_str().as_bytes()
|
||||
/// # ;
|
||||
|
@ -3664,7 +3655,6 @@ declare_clippy_lint! {
|
|||
///
|
||||
/// Use instead:
|
||||
/// ```no_run
|
||||
/// # #![allow(unused)]
|
||||
/// let owned_string = "This is a string".to_owned();
|
||||
/// owned_string.as_bytes()
|
||||
/// # ;
|
||||
|
|
|
@ -243,7 +243,6 @@ impl<'tcx> LateLintPass<'tcx> for OnlyUsedInRecursion {
|
|||
owner_id,
|
||||
..
|
||||
}) => {
|
||||
#[allow(trivial_casts)]
|
||||
if let Node::Item(item) = cx.tcx.parent_hir_node(owner_id.into())
|
||||
&& let Some(trait_ref) = cx
|
||||
.tcx
|
||||
|
|
|
@ -589,9 +589,8 @@ fn find_primitive_impls<'tcx>(tcx: TyCtxt<'tcx>, name: &str) -> impl Iterator<It
|
|||
"u128" => SimplifiedType::Uint(UintTy::U128),
|
||||
"f32" => SimplifiedType::Float(FloatTy::F32),
|
||||
"f64" => SimplifiedType::Float(FloatTy::F64),
|
||||
#[allow(trivial_casts)]
|
||||
_ => {
|
||||
return Result::<_, rustc_errors::ErrorGuaranteed>::Ok(&[] as &[_])
|
||||
return Result::<&[_], rustc_errors::ErrorGuaranteed>::Ok(&[])
|
||||
.into_iter()
|
||||
.flatten()
|
||||
.copied();
|
||||
|
|
Loading…
Reference in a new issue