Skip to content

Commit 8f3cfb4

Browse files
committed
Auto merge of #13182 - Alexendoo:remove-allows, r=Manishearth
Remove some miscellaneous `#[allow]`s Some were unneeded, others were removed by fixing/removing the thing they allow changelog: none
2 parents accf686 + 943a8e0 commit 8f3cfb4

File tree

9 files changed

+10
-43
lines changed

9 files changed

+10
-43
lines changed

clippy_dev/src/serve.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
use std::ffi::OsStr;
2-
use std::num::ParseIntError;
31
use std::path::Path;
42
use std::process::Command;
53
use std::time::{Duration, SystemTime};
@@ -58,8 +56,3 @@ fn mtime(path: impl AsRef<Path>) -> SystemTime {
5856
.unwrap_or(SystemTime::UNIX_EPOCH)
5957
}
6058
}
61-
62-
#[allow(clippy::missing_errors_doc)]
63-
pub fn validate_port(arg: &OsStr) -> Result<(), ParseIntError> {
64-
arg.to_string_lossy().parse::<u16>().map(|_| ())
65-
}

clippy_lints/src/incompatible_msrv.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ impl IncompatibleMsrv {
5555
}
5656
}
5757

58-
#[allow(clippy::cast_lossless)]
5958
fn get_def_id_version(&mut self, tcx: TyCtxt<'_>, def_id: DefId) -> RustcVersion {
6059
if let Some(version) = self.is_above_msrv.get(&def_id) {
6160
return *version;
@@ -67,9 +66,9 @@ impl IncompatibleMsrv {
6766
since: StableSince::Version(version),
6867
..
6968
} => Some(RustcVersion::new(
70-
version.major as _,
71-
version.minor as _,
72-
version.patch as _,
69+
version.major.into(),
70+
version.minor.into(),
71+
version.patch.into(),
7372
)),
7473
_ => None,
7574
}) {

clippy_lints/src/indexing_slicing.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@ declare_clippy_lint! {
7070
///
7171
/// Use instead:
7272
/// ```no_run
73-
/// # #![allow(unused)]
74-
///
7573
/// # let x = vec![0; 5];
7674
/// # let y = [0, 1, 2, 3];
7775
/// x.get(2);

clippy_lints/src/infinite_iter.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ declare_clippy_lint! {
4141
/// ### Example
4242
/// ```no_run
4343
/// let infinite_iter = 0..;
44-
/// # #[allow(unused)]
4544
/// [0..].iter().zip(infinite_iter.take_while(|x| *x > 5));
4645
/// ```
4746
#[clippy::version = "pre 1.29.0"]

clippy_lints/src/lib.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -966,10 +966,3 @@ pub fn register_renamed(ls: &mut rustc_lint::LintStore) {
966966
ls.register_renamed(old_name, new_name);
967967
}
968968
}
969-
970-
// only exists to let the dogfood integration test works.
971-
// Don't run clippy as an executable directly
972-
#[allow(dead_code)]
973-
fn main() {
974-
panic!("Please use the cargo-clippy executable");
975-
}

clippy_lints/src/methods/iter_kv_map.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1-
#![allow(unused_imports)]
2-
31
use super::ITER_KV_MAP;
42
use clippy_config::msrvs::{self, Msrv};
5-
use clippy_utils::diagnostics::{multispan_sugg, span_lint_and_sugg, span_lint_and_then};
6-
use clippy_utils::source::{snippet, snippet_with_applicability};
3+
use clippy_utils::diagnostics::span_lint_and_sugg;
4+
use clippy_utils::pat_is_wild;
5+
use clippy_utils::source::snippet_with_applicability;
76
use clippy_utils::ty::is_type_diagnostic_item;
8-
use clippy_utils::{pat_is_wild, sugg};
9-
use rustc_hir::{BindingMode, Body, BorrowKind, ByRef, Expr, ExprKind, Mutability, Pat, PatKind};
10-
use rustc_lint::{LateContext, LintContext};
11-
use rustc_middle::ty;
12-
use rustc_span::{sym, Span};
7+
use rustc_hir::{Body, Expr, ExprKind, PatKind};
8+
use rustc_lint::LateContext;
9+
use rustc_span::sym;
1310

1411
/// lint use of:
1512
///

clippy_lints/src/methods/mod.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -749,15 +749,13 @@ declare_clippy_lint! {
749749
///
750750
/// ### Example
751751
/// ```no_run
752-
/// # #![allow(unused)]
753752
/// (0_i32..10)
754753
/// .filter(|n| n.checked_add(1).is_some())
755754
/// .map(|n| n.checked_add(1).unwrap());
756755
/// ```
757756
///
758757
/// Use instead:
759758
/// ```no_run
760-
/// # #[allow(unused)]
761759
/// (0_i32..10).filter_map(|n| n.checked_add(1));
762760
/// ```
763761
#[clippy::version = "1.51.0"]
@@ -850,7 +848,6 @@ declare_clippy_lint! {
850848
///
851849
/// ### Example
852850
/// ```no_run
853-
/// # #![allow(unused)]
854851
/// let vec = vec![1];
855852
/// vec.iter().find(|x| **x == 0).is_some();
856853
///
@@ -862,7 +859,6 @@ declare_clippy_lint! {
862859
/// let vec = vec![1];
863860
/// vec.iter().any(|x| *x == 0);
864861
///
865-
/// # #[allow(unused)]
866862
/// !"hello world".contains("world");
867863
/// ```
868864
#[clippy::version = "pre 1.29.0"]
@@ -1505,7 +1501,6 @@ declare_clippy_lint! {
15051501
///
15061502
/// ### Example
15071503
/// ```no_run
1508-
/// # #[allow(unused)]
15091504
/// (0..3).fold(false, |acc, x| acc || x > 2);
15101505
/// ```
15111506
///
@@ -2008,13 +2003,11 @@ declare_clippy_lint! {
20082003
///
20092004
/// ### Example
20102005
/// ```no_run
2011-
/// # #[allow(unused)]
20122006
/// "Hello".bytes().nth(3);
20132007
/// ```
20142008
///
20152009
/// Use instead:
20162010
/// ```no_run
2017-
/// # #[allow(unused)]
20182011
/// "Hello".as_bytes().get(3);
20192012
/// ```
20202013
#[clippy::version = "1.52.0"]
@@ -2059,7 +2052,6 @@ declare_clippy_lint! {
20592052
///
20602053
/// ### Example
20612054
/// ```no_run
2062-
/// # #![allow(unused)]
20632055
/// let some_vec = vec![0, 1, 2, 3];
20642056
///
20652057
/// some_vec.iter().count();
@@ -3656,15 +3648,13 @@ declare_clippy_lint! {
36563648
///
36573649
/// ### Example
36583650
/// ```no_run
3659-
/// # #![allow(unused)]
36603651
/// let owned_string = "This is a string".to_owned();
36613652
/// owned_string.as_str().as_bytes()
36623653
/// # ;
36633654
/// ```
36643655
///
36653656
/// Use instead:
36663657
/// ```no_run
3667-
/// # #![allow(unused)]
36683658
/// let owned_string = "This is a string".to_owned();
36693659
/// owned_string.as_bytes()
36703660
/// # ;

clippy_lints/src/only_used_in_recursion.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,6 @@ impl<'tcx> LateLintPass<'tcx> for OnlyUsedInRecursion {
243243
owner_id,
244244
..
245245
}) => {
246-
#[allow(trivial_casts)]
247246
if let Node::Item(item) = cx.tcx.parent_hir_node(owner_id.into())
248247
&& let Some(trait_ref) = cx
249248
.tcx

clippy_utils/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -589,9 +589,8 @@ fn find_primitive_impls<'tcx>(tcx: TyCtxt<'tcx>, name: &str) -> impl Iterator<It
589589
"u128" => SimplifiedType::Uint(UintTy::U128),
590590
"f32" => SimplifiedType::Float(FloatTy::F32),
591591
"f64" => SimplifiedType::Float(FloatTy::F64),
592-
#[allow(trivial_casts)]
593592
_ => {
594-
return Result::<_, rustc_errors::ErrorGuaranteed>::Ok(&[] as &[_])
593+
return Result::<&[_], rustc_errors::ErrorGuaranteed>::Ok(&[])
595594
.into_iter()
596595
.flatten()
597596
.copied();

0 commit comments

Comments
 (0)