repo
stringlengths
6
65
file_url
stringlengths
81
311
file_path
stringlengths
6
227
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:31:58
2026-01-04 20:25:31
truncated
bool
2 classes
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/extend_with_drain.rs
src/tools/clippy/tests/ui/extend_with_drain.rs
#![warn(clippy::extend_with_drain)] #![allow(clippy::iter_with_drain)] use std::collections::BinaryHeap; fn main() { //gets linted let mut vec1 = vec![0u8; 1024]; let mut vec2: std::vec::Vec<u8> = Vec::new(); vec2.extend(vec1.drain(..)); //~^ extend_with_drain let mut vec3 = vec![0u8; 1024]; ...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/neg_cmp_op_on_partial_ord.rs
src/tools/clippy/tests/ui/neg_cmp_op_on_partial_ord.rs
//! This test case utilizes `f64` an easy example for `PartialOrd` only types //! but the lint itself actually validates any expression where the left //! operand implements `PartialOrd` but not `Ord`. use std::cmp::Ordering; #[allow(clippy::unnested_or_patterns, clippy::match_like_matches_macro)] #[warn(clippy::neg_...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/ptr_eq.rs
src/tools/clippy/tests/ui/ptr_eq.rs
#![warn(clippy::ptr_eq)] #![allow(function_casts_as_integer)] macro_rules! mac { ($a:expr, $b:expr) => { $a as *const _ as usize == $b as *const _ as usize }; (cast $a:expr) => { $a as *const [i32; 3] }; } macro_rules! another_mac { ($a:expr, $b:expr) => { $a as *const _ ==...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/waker_clone_wake.rs
src/tools/clippy/tests/ui/waker_clone_wake.rs
#[derive(Clone)] pub struct Custom; impl Custom { pub fn wake(self) {} } macro_rules! mac { ($cx:ident) => { $cx.waker() }; } pub fn wake(cx: &mut std::task::Context) { cx.waker().clone().wake(); //~^ waker_clone_wake mac!(cx).clone().wake(); //~^ waker_clone_wake } pub fn no_li...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/if_let_mutex.rs
src/tools/clippy/tests/ui/if_let_mutex.rs
//@ compile-flags: -Zunstable-options //@revisions: edition2021 edition2024 //@[edition2021] edition:2021 //@[edition2024] edition:2024 //@[edition2024] check-pass #![warn(clippy::if_let_mutex)] #![allow(clippy::redundant_pattern_matching)] use std::ops::Deref; use std::sync::Mutex; fn do_stuff<T>(_: T) {} fn if_le...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/implicit_return.rs
src/tools/clippy/tests/ui/implicit_return.rs
//@aux-build: proc_macros.rs #![warn(clippy::implicit_return)] #![allow(clippy::needless_return, clippy::needless_bool, unused, clippy::never_loop)] extern crate proc_macros; use proc_macros::with_span; fn test_end_of_fn() -> bool { if true { // no error! return true; } true //~^ imp...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/future_not_send.rs
src/tools/clippy/tests/ui/future_not_send.rs
#![warn(clippy::future_not_send)] use std::cell::Cell; use std::future::Future; use std::rc::Rc; use std::sync::Arc; async fn private_future(rc: Rc<[u8]>, cell: &Cell<usize>) -> bool { //~^ future_not_send async { true }.await } pub async fn public_future(rc: Rc<[u8]>) { //~^ future_not_send async ...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/unnecessary_cast.rs
src/tools/clippy/tests/ui/unnecessary_cast.rs
//@aux-build:extern_fake_libc.rs #![warn(clippy::unnecessary_cast)] #![allow( clippy::borrow_as_ptr, clippy::multiple_bound_locations, clippy::no_effect, clippy::nonstandard_macro_braces, clippy::unnecessary_operation, nonstandard_style, unused )] extern crate extern_fake_libc; type PtrCon...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/cognitive_complexity_attr_used.rs
src/tools/clippy/tests/ui/cognitive_complexity_attr_used.rs
#![warn(unused, clippy::cognitive_complexity)] #![allow(unused_crate_dependencies)] fn main() { kaboom(); } #[clippy::cognitive_complexity = "0"] fn kaboom() { //~^ cognitive_complexity if 42 == 43 { panic!(); } else if "cake" == "lie" { println!("what?"); } }
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/format_push_string_no_core.rs
src/tools/clippy/tests/ui/format_push_string_no_core.rs
//@check-pass #![warn(clippy::format_push_string)] #![no_std] #![feature(no_core)] #![no_core] extern crate alloc; use alloc::format; use alloc::string::String; fn foo(string: &mut String) { // can't suggest even `core::fmt::Write` because of `#![no_core]` string.push_str(&format!("{:?}", 1234)); }
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/suspicious_doc_comments_unfixable.rs
src/tools/clippy/tests/ui/suspicious_doc_comments_unfixable.rs
#![allow(unused, clippy::empty_line_after_doc_comments)] #![warn(clippy::suspicious_doc_comments)] //@no-rustfix ///! a //~^ suspicious_doc_comments ///! b /// c ///! d pub fn foo() {} ///! a //~^ suspicious_doc_comments ///! b /// c ///! d use std::mem; fn main() {}
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/manual_slice_fill.rs
src/tools/clippy/tests/ui/manual_slice_fill.rs
#![warn(clippy::manual_slice_fill)] #![allow(clippy::needless_range_loop, clippy::useless_vec)] macro_rules! assign_element { ($slice:ident, $index:expr) => { $slice[$index] = 0; }; } macro_rules! assign_element_2 { ($i:expr) => { $i = 0; }; } struct NoClone; fn num() -> usize { ...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/panic_in_result_fn_debug_assertions.rs
src/tools/clippy/tests/ui/panic_in_result_fn_debug_assertions.rs
//@ check-pass #![warn(clippy::panic_in_result_fn)] #![allow(clippy::uninlined_format_args, clippy::unnecessary_wraps)] // debug_assert should never trigger the `panic_in_result_fn` lint struct A; impl A { fn result_with_debug_assert_with_message(x: i32) -> Result<bool, String> { debug_assert!(x == 5, "...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/unnecessary_filter_map.rs
src/tools/clippy/tests/ui/unnecessary_filter_map.rs
#![allow(clippy::redundant_closure)] fn main() { let _ = (0..4).filter_map(|x| if x > 1 { Some(x) } else { None }); //~^ unnecessary_filter_map let _ = (0..4).filter_map(|x| { //~^ unnecessary_filter_map if x > 1 { return Some(x); }; None }); let _ = (0...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/floating_point_arithmetic_nostd.rs
src/tools/clippy/tests/ui/floating_point_arithmetic_nostd.rs
//@ check-pass #![crate_type = "lib"] #![warn(clippy::imprecise_flops)] #![warn(clippy::suboptimal_flops)] #![no_std] // The following should not lint, as the suggested methods `{f16,f32,f64,f128}.mul_add()` // and `{f16,f32,f64,f128}::abs()` are not available in no_std pub fn mul_add() { let a: f64 = 1234.567; ...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/blocks_in_conditions.rs
src/tools/clippy/tests/ui/blocks_in_conditions.rs
//@aux-build:proc_macro_attr.rs #![warn(clippy::blocks_in_conditions)] #![allow( unused, unnecessary_transmutes, clippy::needless_ifs, clippy::missing_transmute_annotations )] #![warn(clippy::nonminimal_bool)] macro_rules! blocky { () => {{ true }}; } macro_rules! blocky_too { () => {{ ...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/misnamed_getters_2021.rs
src/tools/clippy/tests/ui/misnamed_getters_2021.rs
//@edition: 2021 #![allow(unused)] #![allow(clippy::struct_field_names)] #![warn(clippy::misnamed_getters)] // Edition 2021 specific check, where `unsafe` blocks are not required // inside `unsafe fn`. union B { a: u8, b: u8, } impl B { unsafe fn a(&self) -> &u8 { //~^ misnamed_getters &...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/collapsible_else_if_unfixable.rs
src/tools/clippy/tests/ui/collapsible_else_if_unfixable.rs
//@no-rustfix #![warn(clippy::collapsible_else_if)] fn issue_13365() { // in the following examples, we won't lint because of the comments, // so the the `expect` will be unfulfilled if true { } else { // some other text before #[expect(clippy::collapsible_else_if)] if false {} ...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/assertions_on_result_states.rs
src/tools/clippy/tests/ui/assertions_on_result_states.rs
#![warn(clippy::assertions_on_result_states)] #![allow(clippy::unnecessary_literal_unwrap)] use std::result::Result; struct Foo; #[derive(Debug)] struct DebugFoo; #[derive(Copy, Clone, Debug)] struct CopyFoo; macro_rules! get_ok_macro { () => { Ok::<_, DebugFoo>(Foo) }; } fn main() { // test o...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/iter_overeager_cloned.rs
src/tools/clippy/tests/ui/iter_overeager_cloned.rs
#![warn(clippy::iter_overeager_cloned, clippy::redundant_iter_cloned, clippy::filter_next)] #![allow( dead_code, clippy::let_unit_value, clippy::useless_vec, clippy::double_ended_iterator_last )] fn main() { let vec = vec!["1".to_string(), "2".to_string(), "3".to_string()]; let _: Option<Strin...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/unnecessary_to_owned_on_split.rs
src/tools/clippy/tests/ui/unnecessary_to_owned_on_split.rs
#![allow(clippy::single_char_pattern)] struct Issue12068; impl AsRef<str> for Issue12068 { fn as_ref(&self) -> &str { "" } } #[allow(clippy::to_string_trait_impl)] impl ToString for Issue12068 { fn to_string(&self) -> String { String::new() } } fn main() { let _ = "a".to_string()...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/four_forward_slashes_bare_cr.rs
src/tools/clippy/tests/ui/four_forward_slashes_bare_cr.rs
//@no-rustfix #![warn(clippy::four_forward_slashes)] //~v four_forward_slashes //// nondoc comment with bare CR: ' ' fn main() {}
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/cast_lossless_integer.rs
src/tools/clippy/tests/ui/cast_lossless_integer.rs
#![allow(clippy::no_effect, clippy::unnecessary_operation, dead_code)] #![warn(clippy::cast_lossless)] type I64Alias = i64; fn main() { // Test clippy::cast_lossless with casts to integer types 0u8 as u16; //~^ cast_lossless 0u8 as i16; //~^ cast_lossless 0u8 as u32; //~^ cast_lossless ...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/unnecessary_literal_bound.rs
src/tools/clippy/tests/ui/unnecessary_literal_bound.rs
#![warn(clippy::unnecessary_literal_bound)] struct Struct<'a> { not_literal: &'a str, } impl Struct<'_> { // Should warn fn returns_lit(&self) -> &str { //~^ unnecessary_literal_bound "Hello" } // Should NOT warn fn returns_non_lit(&self) -> &str { self.not_literal ...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/manual_filter_map.rs
src/tools/clippy/tests/ui/manual_filter_map.rs
#![allow(dead_code)] #![warn(clippy::manual_filter_map)] #![allow(clippy::redundant_closure)] // FIXME suggestion may have redundant closure #![allow(clippy::useless_vec)] #![allow(clippy::struct_field_names)] fn main() { // is_some(), unwrap() let _ = (0..).filter(|n| to_opt(*n).is_some()).map(|a| to_opt(a).u...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/filter_map_next.rs
src/tools/clippy/tests/ui/filter_map_next.rs
#![warn(clippy::filter_map_next)] fn main() { let a = ["1", "lol", "3", "NaN", "5"]; #[rustfmt::skip] let _: Option<u32> = vec![1, 2, 3, 4, 5, 6] //~^ filter_map_next .into_iter() .filter_map(|x| { if x == 2 { Some(x * 2) } else { ...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/single_component_path_imports_nested_first.rs
src/tools/clippy/tests/ui/single_component_path_imports_nested_first.rs
#![warn(clippy::single_component_path_imports)] #![allow(unused_imports)] //@no-rustfix use regex; //~^ single_component_path_imports use serde as edres; pub use serde; fn main() { regex::Regex::new(r"^\d{4}-\d{2}-\d{2}$").unwrap(); } mod root_nested_use_mod { use {regex, serde}; //~^ single_component_p...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/redundant_pattern_matching_poll.rs
src/tools/clippy/tests/ui/redundant_pattern_matching_poll.rs
#![warn(clippy::redundant_pattern_matching)] #![allow( clippy::needless_bool, clippy::needless_ifs, clippy::match_like_matches_macro, clippy::equatable_if_let, clippy::if_same_then_else )] use std::task::Poll::{self, Pending, Ready}; fn main() { if let Pending = Pending::<()> {} //~^ redun...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/should_panic_without_expect.rs
src/tools/clippy/tests/ui/should_panic_without_expect.rs
//@no-rustfix #![deny(clippy::should_panic_without_expect)] #[test] #[should_panic] //~^ should_panic_without_expect fn no_message() {} #[test] #[should_panic] #[cfg(not(test))] fn no_message_cfg_false() {} #[test] #[should_panic = "message"] fn metastr() {} #[test] #[should_panic(expected = "message")] fn metalist...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/empty_loop_no_std.rs
src/tools/clippy/tests/ui/empty_loop_no_std.rs
//@compile-flags: -Clink-arg=-nostartfiles #![warn(clippy::empty_loop)] #![crate_type = "lib"] #![no_std] pub fn main(argc: isize, argv: *const *const u8) -> isize { // This should trigger the lint loop {} //~^ empty_loop }
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/manual_assert.rs
src/tools/clippy/tests/ui/manual_assert.rs
//@revisions: edition2018 edition2021 //@[edition2018] edition:2018 //@[edition2021] edition:2021 #![warn(clippy::manual_assert)] #![allow(dead_code, unused_doc_comments)] #![allow(clippy::nonminimal_bool, clippy::uninlined_format_args, clippy::useless_vec)] macro_rules! one { () => { 1 }; } fn main(...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/needless_raw_string_hashes.rs
src/tools/clippy/tests/ui/needless_raw_string_hashes.rs
#![allow(clippy::no_effect, unused)] #![warn(clippy::needless_raw_string_hashes)] fn main() { r#"\aaa"#; //~^ needless_raw_string_hashes r##"Hello "world"!"##; //~^ needless_raw_string_hashes r######" "### "## "# "######; //~^ needless_raw_string_hashes r######" "aa" "# "## "######; //~...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/manual_inspect.rs
src/tools/clippy/tests/ui/manual_inspect.rs
#![allow(clippy::no_effect, clippy::op_ref, clippy::uninlined_format_args)] #![warn(clippy::manual_inspect)] fn main() { let _ = Some(0).map(|x| { //~^ manual_inspect println!("{}", x); x }); let _ = Some(0).map(|x| { //~^ manual_inspect println!("{x}"); x ...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/ref_as_ptr.rs
src/tools/clippy/tests/ui/ref_as_ptr.rs
#![warn(clippy::ref_as_ptr)] #![allow(clippy::unnecessary_mut_passed, clippy::needless_lifetimes)] fn f<T>(_: T) {} fn main() { f(&1u8 as *const _); //~^ ref_as_ptr f(&2u32 as *const u32); //~^ ref_as_ptr f(&3.0f64 as *const f64); //~^ ref_as_ptr f(&4 as *const _ as *const f32); //~^ ...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/asm_syntax_x86.rs
src/tools/clippy/tests/ui/asm_syntax_x86.rs
//@only-target: i686 x86_64 #[warn(clippy::inline_asm_x86_intel_syntax)] mod warn_intel { use std::arch::{asm, global_asm}; pub(super) unsafe fn use_asm() { unsafe { asm!(""); //~^ inline_asm_x86_intel_syntax asm!("", options()); //~^ inline_asm_x86_int...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/assertions_on_constants.rs
src/tools/clippy/tests/ui/assertions_on_constants.rs
#![allow(non_fmt_panics, clippy::needless_bool, clippy::eq_op)] macro_rules! assert_const { ($len:expr) => { assert!($len > 0); debug_assert!($len < 0); }; } fn main() { assert!(true); //~^ assertions_on_constants assert!(false); //~^ assertions_on_constants assert!(true, ...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/manual_main_separator_str.rs
src/tools/clippy/tests/ui/manual_main_separator_str.rs
#![allow(unused)] #![warn(clippy::manual_main_separator_str)] use std::path::MAIN_SEPARATOR; fn len(s: &str) -> usize { s.len() } struct U<'a> { f: &'a str, g: &'a String, } struct V<T> { f: T, } fn main() { // Should lint let _: &str = &MAIN_SEPARATOR.to_string(); //~^ manual_main_sepa...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/needless_character_iteration.rs
src/tools/clippy/tests/ui/needless_character_iteration.rs
#![warn(clippy::needless_character_iteration)] #![allow(clippy::map_identity, clippy::unnecessary_operation)] #[derive(Default)] struct S { field: &'static str, } impl S { fn field(&self) -> &str { self.field } } fn magic(_: char) {} fn main() { "foo".chars().all(|c| c.is_ascii()); //~^ ...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/while_let_loop.rs
src/tools/clippy/tests/ui/while_let_loop.rs
#![warn(clippy::while_let_loop)] #![allow(clippy::uninlined_format_args)] //@no-rustfix fn main() { let y = Some(true); loop { //~^ while_let_loop if let Some(_x) = y { let _v = 1; } else { break; } } #[allow(clippy::never_loop)] loop { ...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/iter_skip_next_unfixable.rs
src/tools/clippy/tests/ui/iter_skip_next_unfixable.rs
#![warn(clippy::iter_skip_next)] #![allow(dead_code, clippy::iter_out_of_bounds)] //@no-rustfix /// Checks implementation of `ITER_SKIP_NEXT` lint fn main() { // fix #8128 let test_string = "1|1 2"; let sp = test_string.split('|').map(|s| s.trim()); let _: Vec<&str> = sp.skip(1).next().unwrap().split(' ...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/missing_spin_loop_no_std.rs
src/tools/clippy/tests/ui/missing_spin_loop_no_std.rs
#![warn(clippy::missing_spin_loop)] #![crate_type = "lib"] #![no_std] use core::sync::atomic::{AtomicBool, Ordering}; pub fn main(_argc: isize, _argv: *const *const u8) -> isize { // This should trigger the lint let b = AtomicBool::new(true); // This should lint with `core::hint::spin_loop()` while b....
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/needless_question_mark.rs
src/tools/clippy/tests/ui/needless_question_mark.rs
#![warn(clippy::needless_question_mark)] #![allow( clippy::needless_return, clippy::unnecessary_unwrap, clippy::upper_case_acronyms, dead_code, unused_must_use )] struct TO { magic: Option<usize>, } struct TR { magic: Result<usize, bool>, } fn simple_option_bad1(to: TO) -> Option<usize> {...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/four_forward_slashes.rs
src/tools/clippy/tests/ui/four_forward_slashes.rs
//@aux-build:proc_macros.rs #![feature(custom_inner_attributes)] #![allow(unused)] #![warn(clippy::four_forward_slashes)] #![no_main] #![rustfmt::skip] #[macro_use] extern crate proc_macros; //// whoops //~^ four_forward_slashes fn a() {} //// whoops //~^ four_forward_slashes #[allow(dead_code)] fn b() {} //// whoo...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/map_all_any_identity.rs
src/tools/clippy/tests/ui/map_all_any_identity.rs
#![warn(clippy::map_all_any_identity)] fn main() { let _ = ["foo"].into_iter().map(|s| s == "foo").any(|a| a); //~^ map_all_any_identity let _ = ["foo"].into_iter().map(|s| s == "foo").all(std::convert::identity); //~^ map_all_any_identity // // Do not lint // // Not identity let ...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/manual_retain.rs
src/tools/clippy/tests/ui/manual_retain.rs
#![warn(clippy::manual_retain)] #![allow(unused, clippy::needless_borrowed_reference, clippy::redundant_clone)] use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque}; fn main() { binary_heap_retain(); btree_set_retain(); btree_map_retain(); hash_set_retain(); hash_map_r...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/explicit_auto_deref.rs
src/tools/clippy/tests/ui/explicit_auto_deref.rs
#![feature(closure_lifetime_binder)] #![warn(clippy::explicit_auto_deref)] #![allow( dead_code, unused_braces, clippy::borrowed_box, clippy::needless_borrow, clippy::needless_return, clippy::ptr_arg, clippy::redundant_field_names, clippy::too_many_arguments, clippy::borrow_deref_ref,...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/iter_kv_map.rs
src/tools/clippy/tests/ui/iter_kv_map.rs
#![warn(clippy::iter_kv_map)] #![allow(unused_mut, clippy::redundant_clone, clippy::suspicious_map, clippy::map_identity)] use std::collections::{BTreeMap, HashMap}; fn main() { let get_key = |(key, _val)| key; fn ref_acceptor(v: &u32) -> u32 { *v } let map: HashMap<u32, u32> = HashMap::new()...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/let_underscore_must_use.rs
src/tools/clippy/tests/ui/let_underscore_must_use.rs
#![warn(clippy::let_underscore_must_use)] #![allow(clippy::unnecessary_wraps)] // Debug implementations can fire this lint, // so we shouldn't lint external macros #[derive(Debug)] struct Foo { field: i32, } #[must_use] fn f() -> u32 { 0 } fn g() -> Result<u32, u32> { Ok(0) } #[must_use] fn l<T>(x: T) -...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/ref_binding_to_reference.rs
src/tools/clippy/tests/ui/ref_binding_to_reference.rs
// FIXME: run-rustfix waiting on multi-span suggestions //@no-rustfix #![warn(clippy::ref_binding_to_reference)] #![allow(clippy::needless_borrowed_reference, clippy::explicit_auto_deref)] fn f1(_: &str) {} macro_rules! m2 { ($e:expr) => { f1(*$e) }; } macro_rules! m3 { ($i:ident) => { Some...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/collapsible_if_let_chains.rs
src/tools/clippy/tests/ui/collapsible_if_let_chains.rs
//@revisions: edition2021 edition2024 //@[edition2021] edition:2021 //@[edition2024] edition:2024 //@[edition2021] check-pass #![warn(clippy::collapsible_if)] fn main() { if let Some(a) = Some(3) { // with comment, so do not lint if let Some(b) = Some(4) { let _ = a + b; } ...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/transmute_collection.rs
src/tools/clippy/tests/ui/transmute_collection.rs
#![warn(clippy::unsound_collection_transmute)] #![allow(clippy::missing_transmute_annotations)] use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque}; use std::mem::{MaybeUninit, transmute}; fn main() { unsafe { // wrong size let _ = transmute::<_, Vec<u32>>(vec![0u8])...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/debug_assert_with_mut_call.rs
src/tools/clippy/tests/ui/debug_assert_with_mut_call.rs
#![feature(custom_inner_attributes)] #![rustfmt::skip] #![warn(clippy::debug_assert_with_mut_call)] #![allow(clippy::redundant_closure_call, clippy::get_first)] struct S; impl S { fn bool_self_ref(&self) -> bool { false } fn bool_self_mut(&mut self) -> bool { false } fn bool_self_ref_arg_ref(&self, _: &u...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/semicolon_inside_block_stmt_expr_attrs.rs
src/tools/clippy/tests/ui/semicolon_inside_block_stmt_expr_attrs.rs
// Test when the feature `stmt_expr_attributes` is enabled #![feature(stmt_expr_attributes)] #![allow(clippy::no_effect)] #![warn(clippy::semicolon_inside_block)] pub fn issue15388() { #[rustfmt::skip] {0; 0}; //~^ semicolon_inside_block }
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/mutex_atomic.rs
src/tools/clippy/tests/ui/mutex_atomic.rs
#![warn(clippy::mutex_integer)] #![warn(clippy::mutex_atomic)] #![allow(clippy::borrow_as_ptr)] use std::sync::Mutex; fn main() { let _ = Mutex::new(true); //~^ mutex_atomic let _ = Mutex::new(5usize); //~^ mutex_atomic let _ = Mutex::new(9isize); //~^ mutex_atomic let mut x = 4u32; ...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/doc_errors.rs
src/tools/clippy/tests/ui/doc_errors.rs
#![warn(clippy::missing_errors_doc)] #![allow(clippy::result_unit_err)] #![allow(clippy::unnecessary_wraps)] use std::io; pub fn pub_fn_missing_errors_header() -> Result<(), ()> { //~^ missing_errors_doc unimplemented!(); } pub async fn async_pub_fn_missing_errors_header() -> Result<(), ()> { //~^ missi...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/match_same_arms.rs
src/tools/clippy/tests/ui/match_same_arms.rs
#![allow(clippy::manual_range_patterns)] #![warn(clippy::match_same_arms)] pub enum Abc { A, B, C, } fn match_same_arms() { let _ = match Abc::A { Abc::A => 0, Abc::B => 1, _ => 0, //~^ match_same_arms }; match 0 { 1 => 'a', 2 => 'b', 3 ...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/format_args.rs
src/tools/clippy/tests/ui/format_args.rs
#![warn(clippy::to_string_in_format_args)] #![allow(unused)] #![allow( clippy::assertions_on_constants, clippy::double_parens, clippy::eq_op, clippy::print_literal, clippy::uninlined_format_args )] use std::io::{Write, stdout}; use std::ops::Deref; use std::panic::Location; struct Somewhere; #[al...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/collapsible_if_unfixable.rs
src/tools/clippy/tests/ui/collapsible_if_unfixable.rs
//@ no-rustfix #![warn(clippy::collapsible_if)] fn issue13365() { // in the following examples, we won't lint because of the comments, // so the the `expect` will be unfulfilled if true { // don't collapsible because of this comment #[expect(clippy::collapsible_if)] if true {} }...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/match_like_matches_macro.rs
src/tools/clippy/tests/ui/match_like_matches_macro.rs
#![warn(clippy::match_like_matches_macro)] #![allow( unreachable_patterns, irrefutable_let_patterns, clippy::equatable_if_let, clippy::needless_borrowed_reference, clippy::redundant_guards )] fn main() { let x = Some(5); // Lint let _y = match x { Some(0) => true, _ => ...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/derivable_impls.rs
src/tools/clippy/tests/ui/derivable_impls.rs
#![allow(dead_code)] #![feature(const_trait_impl)] #![feature(const_default)] use std::collections::HashMap; struct FooDefault<'a> { a: bool, b: i32, c: u64, d: Vec<i32>, e: FooND1, f: FooND2, g: HashMap<i32, i32>, h: (i32, Vec<i32>), i: [Vec<i32>; 3], j: [i32; 5], k: Optio...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/floating_point_mul_add.rs
src/tools/clippy/tests/ui/floating_point_mul_add.rs
#![warn(clippy::suboptimal_flops)] /// Allow suboptimal_ops in constant context pub const fn in_const_context() { let a: f64 = 1234.567; let b: f64 = 45.67834; let c: f64 = 0.0004; let _ = a * b + c; let _ = c + a * b; } fn main() { let a: f64 = 1234.567; let b: f64 = 45.67834; let c:...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/manual_rotate.rs
src/tools/clippy/tests/ui/manual_rotate.rs
#![warn(clippy::manual_rotate)] #![allow(unused)] fn main() { let (x_u8, x_u16, x_u32, x_u64) = (1u8, 1u16, 1u32, 1u64); let (x_i8, x_i16, x_i32, x_i64) = (1i8, 1i16, 1i32, 1i64); let a_u32 = 1u32; const N: u32 = 5; // True positives let y_u8 = (x_u8 >> 3) | (x_u8 << 5); //~^ manual_rotate ...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/write_literal_unfixable.rs
src/tools/clippy/tests/ui/write_literal_unfixable.rs
//@no-rustfix #![allow(unused_must_use)] #![warn(clippy::write_literal)] use std::io::Write; fn escaping() { let mut v = vec![]; writeln!(v, r"{}", '"'); //~^ write_literal // hard mode writeln!(v, r#"{}{}"#, '#', '"'); //~^ write_literal }
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/if_same_then_else2.rs
src/tools/clippy/tests/ui/if_same_then_else2.rs
#![warn(clippy::if_same_then_else)] #![allow( clippy::disallowed_names, clippy::collapsible_else_if, clippy::equatable_if_let, clippy::collapsible_if, clippy::ifs_same_cond, clippy::needless_ifs, clippy::needless_return, clippy::single_element_loop, clippy::branches_sharing_code )] ...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/ptr_arg.rs
src/tools/clippy/tests/ui/ptr_arg.rs
#![allow( unused, clippy::many_single_char_names, clippy::needless_lifetimes, clippy::redundant_clone, clippy::needless_pass_by_ref_mut )] #![warn(clippy::ptr_arg)] //@no-rustfix use std::borrow::Cow; use std::path::{Path, PathBuf}; fn do_vec(x: &Vec<i64>) { //~^ ptr_arg //Nothing here } ...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/redundant_static_lifetimes_multiple.rs
src/tools/clippy/tests/ui/redundant_static_lifetimes_multiple.rs
//@no-rustfix: overlapping suggestions // these are rustfixable, but run-rustfix tests cannot handle them const VAR_FIVE: &'static [&[&'static str]] = &[&["test"], &["other one"]]; // ERROR: Consider removing 'static //~^ redundant_static_lifetimes //~| redundant_static_lifetimes const VAR_SEVEN: &[&(&str, &'static [...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/string_extend.rs
src/tools/clippy/tests/ui/string_extend.rs
#[derive(Copy, Clone)] struct HasChars; impl HasChars { fn chars(self) -> std::str::Chars<'static> { "HasChars".chars() } } fn main() { let abc = "abc"; let def = String::from("def"); let mut s = String::new(); s.push_str(abc); s.extend(abc.chars()); //~^ string_extend_chars ...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/wildcard_imports_2021.rs
src/tools/clippy/tests/ui/wildcard_imports_2021.rs
//@revisions: edition2018 edition2021 //@[edition2018] edition:2018 //@[edition2021] edition:2021 //@aux-build:wildcard_imports_helper.rs #![warn(clippy::wildcard_imports)] #![allow(unused, clippy::unnecessary_wraps, clippy::let_unit_value)] #![warn(unused_imports)] extern crate wildcard_imports_helper; use crate::...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/match_same_arms_non_exhaustive.rs
src/tools/clippy/tests/ui/match_same_arms_non_exhaustive.rs
#![feature(non_exhaustive_omitted_patterns_lint)] #![warn(clippy::match_same_arms)] #![no_main] use std::sync::atomic::Ordering; // #[non_exhaustive] enum fn repeat() -> ! { panic!() } #[deny(non_exhaustive_omitted_patterns)] pub fn f(x: Ordering) { match x { Ordering::Relaxed => println!("relaxed"), ...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/needless_return_with_question_mark.rs
src/tools/clippy/tests/ui/needless_return_with_question_mark.rs
//@aux-build:proc_macros.rs #![allow( clippy::needless_return, clippy::no_effect, clippy::unit_arg, clippy::useless_conversion, clippy::diverging_sub_expression, clippy::let_unit_value, unused )] #[macro_use] extern crate proc_macros; fn a() -> u32 { return 0; } fn b() -> Result<u32, ...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/borrow_deref_ref_unfixable.rs
src/tools/clippy/tests/ui/borrow_deref_ref_unfixable.rs
//@no-rustfix: overlapping suggestions #![allow(dead_code, unused_variables)] fn main() {} mod should_lint { fn two_helps() { let s = &String::new(); let x: &str = &*s; //~^ borrow_deref_ref } }
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/cast_nan_to_int.rs
src/tools/clippy/tests/ui/cast_nan_to_int.rs
// FIXME(f16_f128): add tests when constants are available #![warn(clippy::cast_nan_to_int)] #![allow(clippy::eq_op)] fn main() { let _ = (0.0_f32 / -0.0) as usize; //~^ cast_nan_to_int let _ = (f64::INFINITY * -0.0) as usize; //~^ cast_nan_to_int let _ = (0.0 * f32::INFINITY) as usize; //~^...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/toplevel_ref_arg_non_rustfix.rs
src/tools/clippy/tests/ui/toplevel_ref_arg_non_rustfix.rs
//@aux-build:proc_macros.rs #![warn(clippy::toplevel_ref_arg)] #![allow(unused)] extern crate proc_macros; use proc_macros::{external, inline_macros}; fn the_answer(ref mut x: u8) { //~^ toplevel_ref_arg *x = 42; } #[inline_macros] fn main() { let mut x = 0; the_answer(x); // lint in macro ...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/iter_count.rs
src/tools/clippy/tests/ui/iter_count.rs
//@aux-build:option_helpers.rs #![warn(clippy::iter_count)] #![allow( unused_variables, array_into_iter, unused_mut, clippy::into_iter_on_ref, clippy::unnecessary_operation, clippy::useless_vec )] extern crate option_helpers; use option_helpers::IteratorFalsePositives; use std::collections::{...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/semicolon_inside_block.rs
src/tools/clippy/tests/ui/semicolon_inside_block.rs
#![allow( unused, clippy::unused_unit, clippy::unnecessary_operation, clippy::no_effect, clippy::single_element_loop, clippy::double_parens )] #![warn(clippy::semicolon_inside_block)] macro_rules! m { (()) => { () }; (0) => {{ 0 };}; (1) => {{ 1; ...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/return_self_not_must_use.rs
src/tools/clippy/tests/ui/return_self_not_must_use.rs
#![crate_type = "lib"] #![warn(clippy::return_self_not_must_use)] #[derive(Clone)] pub struct Bar; pub trait Whatever { fn what(&self) -> Self; //~^ return_self_not_must_use // There should be no warning here! (returns a reference) fn what2(&self) -> &Self; } impl Bar { // There should be no war...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/missing_spin_loop.rs
src/tools/clippy/tests/ui/missing_spin_loop.rs
#![warn(clippy::missing_spin_loop)] #![allow(clippy::bool_comparison)] #![allow(unused_braces)] use core::sync::atomic::{AtomicBool, Ordering}; fn main() { let b = AtomicBool::new(true); // Those should lint while b.load(Ordering::Acquire) {} //~^ missing_spin_loop while !b.load(Ordering::SeqCst)...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/unnecessary_lazy_eval_unfixable.rs
src/tools/clippy/tests/ui/unnecessary_lazy_eval_unfixable.rs
#![warn(clippy::unnecessary_lazy_evaluations)] #![allow(clippy::unnecessary_literal_unwrap)] //@no-rustfix struct Deep(Option<usize>); #[derive(Copy, Clone)] struct SomeStruct { some_field: usize, } fn main() { // fix will break type inference let _ = Ok(1).unwrap_or_else(|()| 2); //~^ unnecessary_laz...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/redundant_test_prefix.rs
src/tools/clippy/tests/ui/redundant_test_prefix.rs
#![allow(dead_code)] #![warn(clippy::redundant_test_prefix)] fn main() { // Normal function, no redundant prefix. } fn f1() { // Normal function, no redundant prefix. } fn test_f2() { // Has prefix, but no `#[test]` attribute, ignore. } #[test] fn test_f3() { //~^ redundant_test_prefix // Has p...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/declare_interior_mutable_const.rs
src/tools/clippy/tests/ui/declare_interior_mutable_const.rs
#![deny(clippy::declare_interior_mutable_const)] #![allow(clippy::missing_const_for_thread_local)] use core::cell::{Cell, RefCell, UnsafeCell}; use core::mem::{ManuallyDrop, MaybeUninit}; use core::ptr; use core::sync::atomic::AtomicUsize; fn main() {} const _: Cell<u32> = Cell::new(0); const UNSAFE_CELL: UnsafeCell...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/redundant_else.rs
src/tools/clippy/tests/ui/redundant_else.rs
#![warn(clippy::redundant_else)] #![allow(clippy::needless_return, clippy::if_same_then_else, clippy::needless_late_init)] fn main() { loop { // break if foo() { println!("Love your neighbor;"); break; } else { //~^ redundant_else println!("y...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/functions.rs
src/tools/clippy/tests/ui/functions.rs
#![allow(clippy::missing_safety_doc, clippy::uninlined_format_args)] // TOO_MANY_ARGUMENTS fn good(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool) {} fn bad(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()) {} //~^ too_many_argument...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/cast_lossless_bool.rs
src/tools/clippy/tests/ui/cast_lossless_bool.rs
#![allow(dead_code)] #![warn(clippy::cast_lossless)] type U8 = u8; fn main() { // Test clippy::cast_lossless with casts to integer types let _ = true as u8; //~^ cast_lossless let _ = true as u16; //~^ cast_lossless let _ = true as u32; //~^ cast_lossless let _ = true as u64; //~^ ...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/drain_collect.rs
src/tools/clippy/tests/ui/drain_collect.rs
#![deny(clippy::drain_collect)] #![allow(dead_code)] use std::collections::{BinaryHeap, HashMap, HashSet, VecDeque}; fn binaryheap(b: &mut BinaryHeap<i32>) -> BinaryHeap<i32> { b.drain().collect() //~^ drain_collect } fn binaryheap_dont_lint(b: &mut BinaryHeap<i32>) -> HashSet<i32> { b.drain().collect() ...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/manual_let_else_question_mark.rs
src/tools/clippy/tests/ui/manual_let_else_question_mark.rs
#![allow(unused_braces, unused_variables, dead_code)] #![allow( clippy::collapsible_else_if, clippy::unused_unit, clippy::let_unit_value, clippy::match_single_binding, clippy::never_loop )] #![warn(clippy::manual_let_else, clippy::question_mark)] enum Variant { A(usize, usize), B(usize), ...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/zero_ptr_no_std.rs
src/tools/clippy/tests/ui/zero_ptr_no_std.rs
#![crate_type = "lib"] #![no_std] #![deny(clippy::zero_ptr)] pub fn main(_argc: isize, _argv: *const *const u8) -> isize { let _ = 0 as *const usize; //~^ zero_ptr let _ = 0 as *mut f64; //~^ zero_ptr let _: *const u8 = 0 as *const _; //~^ zero_ptr 0 }
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/ptr_offset_by_literal.rs
src/tools/clippy/tests/ui/ptr_offset_by_literal.rs
#![warn(clippy::ptr_offset_by_literal)] #![allow(clippy::inconsistent_digit_grouping)] fn main() { let arr = [b'a', b'b', b'c']; let ptr = arr.as_ptr(); let var = 32; const CONST: isize = 42; unsafe { let _ = ptr.offset(0); //~^ ptr_offset_by_literal let _ = ptr.offset(-0)...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/four_forward_slashes_first_line.rs
src/tools/clippy/tests/ui/four_forward_slashes_first_line.rs
//// borked doc comment on the first line. doesn't combust! //~^ four_forward_slashes fn a() {} // This test's entire purpose is to make sure we don't panic if the comment with four slashes // extends to the first line of the file. This is likely pretty rare in production, but an ICE is an // ICE.
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/non_expressive_names.rs
src/tools/clippy/tests/ui/non_expressive_names.rs
#![allow(clippy::println_empty_string, non_snake_case, clippy::let_unit_value)] #[derive(Clone, Debug)] enum MaybeInst { Split, Split1(usize), Split2(usize), } struct InstSplit { uiae: usize, } impl MaybeInst { fn fill(&mut self) { #[allow(non_fmt_panics)] let filled = match *self...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/panicking_macros.rs
src/tools/clippy/tests/ui/panicking_macros.rs
#![allow(clippy::assertions_on_constants, clippy::eq_op, clippy::let_unit_value)] #![warn(clippy::unimplemented, clippy::unreachable, clippy::todo, clippy::panic)] extern crate core; const _: () = { if 1 == 0 { panic!("A balanced diet means a cupcake in each hand"); } }; fn inline_const() { let _...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/blocks_in_conditions_2021.rs
src/tools/clippy/tests/ui/blocks_in_conditions_2021.rs
//@edition: 2021 #![allow(clippy::let_and_return)] // issue #11814 fn block_in_match_expr(num: i32) -> i32 { match { //~^ ERROR: in a `match` scrutinee, avoid complex blocks or closures with blocks; instead, move the block or closure higher and bind it with a `let` let opt = Some(2); opt ...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/result_map_unit_fn_fixable.rs
src/tools/clippy/tests/ui/result_map_unit_fn_fixable.rs
#![warn(clippy::result_map_unit_fn)] fn do_nothing<T>(_: T) {} fn diverge<T>(_: T) -> ! { panic!() } fn plus_one(value: usize) -> usize { value + 1 } struct HasResult { field: Result<usize, usize>, } impl HasResult { fn do_result_nothing(&self, value: usize) {} fn do_result_plus_one(&self, val...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/default_union_representation.rs
src/tools/clippy/tests/ui/default_union_representation.rs
#![feature(transparent_unions)] #![warn(clippy::default_union_representation)] #![allow(clippy::repr_packed_without_abi)] union NoAttribute { //~^ default_union_representation a: i32, b: u32, } #[repr(C)] union ReprC { a: i32, b: u32, } #[repr(packed)] union ReprPacked { //~^ default_union_re...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/zero_sized_btreemap_values.rs
src/tools/clippy/tests/ui/zero_sized_btreemap_values.rs
#![warn(clippy::zero_sized_map_values)] use std::collections::BTreeMap; const CONST_OK: Option<BTreeMap<String, usize>> = None; const CONST_NOT_OK: Option<BTreeMap<String, ()>> = None; //~^ zero_sized_map_values static STATIC_OK: Option<BTreeMap<String, usize>> = None; static STATIC_NOT_OK: Option<BTreeMap<String, ()...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/expect_fun_call.rs
src/tools/clippy/tests/ui/expect_fun_call.rs
#![warn(clippy::expect_fun_call)] #![allow( clippy::to_string_in_format_args, clippy::uninlined_format_args, clippy::unnecessary_literal_unwrap )] macro_rules! one { () => { 1 }; } fn main() { struct Foo; impl Foo { fn new() -> Self { Foo } fn ...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/byte_char_slices.rs
src/tools/clippy/tests/ui/byte_char_slices.rs
#![warn(clippy::byte_char_slices)] fn main() { let bad = &[b'a', b'b', b'c']; //~^ byte_char_slices let quotes = &[b'"', b'H', b'i']; //~^ byte_char_slices let quotes = &[b'\'', b'S', b'u', b'p']; //~^ byte_char_slices let escapes = &[b'\x42', b'E', b's', b'c']; //~^ byte_char_slices ...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/get_unwrap.rs
src/tools/clippy/tests/ui/get_unwrap.rs
#![allow( unused_mut, clippy::from_iter_instead_of_collect, clippy::get_first, clippy::useless_vec, clippy::out_of_bounds_indexing )] #![warn(clippy::unwrap_used)] #![deny(clippy::get_unwrap)] use std::collections::{BTreeMap, HashMap, VecDeque}; struct GetFalsePositive { arr: [u32; 3], } impl...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/match_like_matches_macro_if_let_guard.rs
src/tools/clippy/tests/ui/match_like_matches_macro_if_let_guard.rs
//@check-pass #![warn(clippy::match_like_matches_macro)] #![feature(if_let_guard)] #[expect(clippy::option_option)] fn issue15841(opt: Option<Option<Option<i32>>>, value: i32) { let _ = match opt { Some(first) if let Some(second) = first && let Some(third) = second ...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/derive_ord_xor_partial_ord.rs
src/tools/clippy/tests/ui/derive_ord_xor_partial_ord.rs
#![warn(clippy::derive_ord_xor_partial_ord)] #![allow(clippy::unnecessary_wraps)] #![allow(clippy::non_canonical_partial_ord_impl)] use std::cmp::Ordering; #[derive(PartialOrd, Ord, PartialEq, Eq)] struct DeriveBoth; impl PartialEq<u64> for DeriveBoth { fn eq(&self, _: &u64) -> bool { true } } impl ...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui/manual_arithmetic_check.rs
src/tools/clippy/tests/ui/manual_arithmetic_check.rs
#![warn(clippy::implicit_saturating_sub, clippy::inverted_saturating_sub)] #![allow(clippy::if_same_then_else)] fn main() { let a = 12u32; let b = 13u32; let c = 8u32; let result = if a > b { a - b } else { 0 }; //~^ implicit_saturating_sub let result = if b < a { a - b } else { 0 }; //~^...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false