Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove some miscellaneous #[allow]s #13182

Merged
merged 1 commit into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions clippy_dev/src/serve.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down Expand Up @@ -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(|_| ())
}
7 changes: 3 additions & 4 deletions clippy_lints/src/incompatible_msrv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
}) {
Expand Down
2 changes: 0 additions & 2 deletions clippy_lints/src/indexing_slicing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion clippy_lints/src/infinite_iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
7 changes: 0 additions & 7 deletions clippy_lints/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
15 changes: 6 additions & 9 deletions clippy_lints/src/methods/iter_kv_map.rs
Original file line number Diff line number Diff line change
@@ -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:
///
Expand Down
10 changes: 0 additions & 10 deletions clippy_lints/src/methods/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -749,15 +749,13 @@ 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());
/// ```
///
/// Use instead:
/// ```no_run
/// # #[allow(unused)]
/// (0_i32..10).filter_map(|n| n.checked_add(1));
/// ```
#[clippy::version = "1.51.0"]
Expand Down Expand Up @@ -850,7 +848,6 @@ declare_clippy_lint! {
///
/// ### Example
/// ```no_run
/// # #![allow(unused)]
/// let vec = vec![1];
/// vec.iter().find(|x| **x == 0).is_some();
///
Expand All @@ -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"]
Expand Down Expand Up @@ -1505,7 +1501,6 @@ declare_clippy_lint! {
///
/// ### Example
/// ```no_run
/// # #[allow(unused)]
/// (0..3).fold(false, |acc, x| acc || x > 2);
/// ```
///
Expand Down Expand Up @@ -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"]
Expand Down Expand Up @@ -2059,7 +2052,6 @@ declare_clippy_lint! {
///
/// ### Example
/// ```no_run
/// # #![allow(unused)]
/// let some_vec = vec![0, 1, 2, 3];
///
/// some_vec.iter().count();
Expand Down Expand Up @@ -3656,15 +3648,13 @@ declare_clippy_lint! {
///
/// ### Example
/// ```no_run
/// # #![allow(unused)]
/// let owned_string = "This is a string".to_owned();
/// owned_string.as_str().as_bytes()
/// # ;
/// ```
///
/// Use instead:
/// ```no_run
/// # #![allow(unused)]
/// let owned_string = "This is a string".to_owned();
/// owned_string.as_bytes()
/// # ;
Expand Down
1 change: 0 additions & 1 deletion clippy_lints/src/only_used_in_recursion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions clippy_utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down