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/rest_pat_in_fully_bound_structs.rs | src/tools/clippy/tests/ui/rest_pat_in_fully_bound_structs.rs | #![warn(clippy::rest_pat_in_fully_bound_structs)]
#![allow(clippy::struct_field_names)]
struct A {
a: i32,
b: i64,
c: &'static str,
}
macro_rules! foo {
($param:expr) => {
match $param {
A { a: 0, b: 0, c: "", .. } => {},
_ => {},
}
};
}
fn main() {
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_c_str_literals.rs | src/tools/clippy/tests/ui/manual_c_str_literals.rs | //@revisions: edition2018 edition2021
//@[edition2018] edition:2018
//@[edition2021] edition:2021
//@[edition2018] check-pass
#![warn(clippy::manual_c_str_literals)]
#![allow(clippy::no_effect)]
use std::ffi::CStr;
macro_rules! cstr {
($s:literal) => {
CStr::from_bytes_with_nul(concat!($s, "\0").as_bytes(... | 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/msrv_attributes_without_early_lints.rs | src/tools/clippy/tests/ui/msrv_attributes_without_early_lints.rs | //@check-pass
#![allow(clippy::all, clippy::pedantic, clippy::restriction, clippy::nursery)]
#![forbid(clippy::ptr_as_ptr)]
/// MSRV checking in late passes skips checking the parent nodes if no early pass sees a
/// `#[clippy::msrv]` attribute
///
/// Here we ensure that even if all early passes are allowed (above) ... | 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/duplicated_attributes.rs | src/tools/clippy/tests/ui/duplicated_attributes.rs | //@aux-build:proc_macro_attr.rs
#![warn(clippy::duplicated_attributes, clippy::duplicated_attributes)] //~ ERROR: duplicated attribute
#![feature(rustc_attrs)]
#![cfg(any(unix, windows))]
#![allow(dead_code)]
#![allow(dead_code)] //~ ERROR: duplicated attribute
#![cfg(any(unix, windows))] // Should not warn!
#[macro_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/result_unit_error.rs | src/tools/clippy/tests/ui/result_unit_error.rs | #![warn(clippy::result_unit_err)]
pub fn returns_unit_error() -> Result<u32, ()> {
//~^ result_unit_err
Err(())
}
fn private_unit_errors() -> Result<String, ()> {
Err(())
}
pub trait HasUnitError {
fn get_that_error(&self) -> Result<bool, ()>;
//~^ result_unit_err
fn get_this_one_too(&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/zero_ptr.rs | src/tools/clippy/tests/ui/zero_ptr.rs | pub fn foo(_const: *const f32, _mut: *mut i64) {}
fn main() {
let _ = 0 as *const usize;
//~^ zero_ptr
let _ = 0 as *mut f64;
//~^ zero_ptr
let _: *const u8 = 0 as *const _;
//~^ zero_ptr
foo(0 as _, 0 as _);
foo(0 as *const _, 0 as *mut _);
//~^ zero_ptr
//~| zero_ptr
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/const_comparisons.rs | src/tools/clippy/tests/ui/const_comparisons.rs | #![allow(
unused,
clippy::identity_op,
clippy::manual_range_contains,
clippy::no_effect,
clippy::short_circuit_statement
)]
#![warn(clippy::impossible_comparisons, clippy::redundant_comparisons)]
const STATUS_BAD_REQUEST: u16 = 400;
const STATUS_SERVER_ERROR: u16 = 500;
struct Status {
code: 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/or_then_unwrap.rs | src/tools/clippy/tests/ui/or_then_unwrap.rs | #![warn(clippy::or_then_unwrap)]
#![allow(clippy::map_identity, clippy::let_unit_value, clippy::unnecessary_literal_unwrap)]
struct SomeStruct;
impl SomeStruct {
fn or(self, _: Option<Self>) -> Self {
self
}
fn unwrap(&self) {}
}
struct SomeOtherStruct;
impl SomeOtherStruct {
fn or(self) -> Se... | 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_last_with_len.rs | src/tools/clippy/tests/ui/get_last_with_len.rs | #![warn(clippy::get_last_with_len)]
#![allow(unused, clippy::useless_vec)]
use std::collections::VecDeque;
fn dont_use_last() {
let x = vec![2, 3, 5];
let _ = x.get(x.len() - 1);
//~^ get_last_with_len
}
fn indexing_two_from_end() {
let x = vec![2, 3, 5];
let _ = x.get(x.len() - 2);
}
fn index_i... | 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/extra_unused_type_parameters_unfixable.rs | src/tools/clippy/tests/ui/extra_unused_type_parameters_unfixable.rs | #![warn(clippy::extra_unused_type_parameters)]
fn unused_where_clause<T, U>(x: U)
//~^ extra_unused_type_parameters
where
T: Default,
{
unimplemented!();
}
fn unused_multi_where_clause<T, U, V: Default>(x: U)
//~^ extra_unused_type_parameters
where
T: Default,
{
unimplemented!();
}
fn unused_all_wher... | 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/read_line_without_trim.rs | src/tools/clippy/tests/ui/read_line_without_trim.rs | #![allow(unused)]
#![warn(clippy::read_line_without_trim)]
fn main() {
let mut input = String::new();
std::io::stdin().read_line(&mut input).unwrap();
input.pop();
let _x: i32 = input.parse().unwrap(); // don't trigger here, newline character is popped
let mut input = String::new();
std::io::s... | 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_with_type_underscore.rs | src/tools/clippy/tests/ui/let_with_type_underscore.rs | //@aux-build: proc_macros.rs
#![allow(unused)]
#![warn(clippy::let_with_type_underscore)]
#![allow(clippy::let_unit_value, clippy::needless_late_init)]
extern crate proc_macros;
fn func() -> &'static str {
""
}
#[rustfmt::skip]
fn main() {
// Will lint
let x: _ = 1;
//~^ let_with_type_underscore
... | 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_into_iter_loop.rs | src/tools/clippy/tests/ui/explicit_into_iter_loop.rs | #![allow(non_local_definitions)]
#![warn(clippy::explicit_into_iter_loop)]
fn main() {
// Issue #4958
fn _takes_iterator<T>(iterator: &T)
where
for<'a> &'a T: IntoIterator<Item = &'a String>,
{
for _ in iterator.into_iter() {}
//~^ explicit_into_iter_loop
}
struct 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/missing_transmute_annotations_unfixable.rs | src/tools/clippy/tests/ui/missing_transmute_annotations_unfixable.rs | //@no-rustfix
fn issue14984() {
async fn e() {}
async fn x() -> u32 {
0
}
async fn y() -> f32 {
0.0
};
let mut yy = unsafe { std::ptr::read(&y()) };
yy = unsafe { std::mem::transmute(std::ptr::read(&x())) };
//~^ missing_transmute_annotations
let mut zz = 0u8;
z... | 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_os_str_debug_formatting.rs | src/tools/clippy/tests/ui/unnecessary_os_str_debug_formatting.rs | #![warn(clippy::unnecessary_debug_formatting)]
#![allow(clippy::uninlined_format_args)]
use std::ffi::{OsStr, OsString};
fn main() {
let os_str = OsStr::new("abc");
let os_string = os_str.to_os_string();
// negative tests
println!("{}", os_str.display());
println!("{}", os_string.display());
... | 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/verbose_file_reads.rs | src/tools/clippy/tests/ui/verbose_file_reads.rs | #![warn(clippy::verbose_file_reads)]
use std::env::temp_dir;
use std::fs::File;
use std::io::Read;
struct Struct;
// To make sure we only warn on File::{read_to_end, read_to_string} calls
impl Struct {
pub fn read_to_end(&self) {}
pub fn read_to_string(&self) {}
}
fn main() -> std::io::Result<()> {
let 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/from_over_into.rs | src/tools/clippy/tests/ui/from_over_into.rs | #![feature(type_alias_impl_trait)]
#![warn(clippy::from_over_into)]
#![allow(non_local_definitions)]
#![allow(unused)]
// this should throw an error
struct StringWrapper(String);
impl Into<StringWrapper> for String {
//~^ from_over_into
fn into(self) -> StringWrapper {
StringWrapper(self)
}
}
str... | 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/pathbuf_init_then_push.rs | src/tools/clippy/tests/ui/pathbuf_init_then_push.rs | #![warn(clippy::pathbuf_init_then_push)]
use std::path::PathBuf;
fn main() {
let mut path_buf = PathBuf::new();
//~^ pathbuf_init_then_push
path_buf.push("foo");
path_buf = PathBuf::from("foo");
//~^ pathbuf_init_then_push
path_buf.push("bar");
let bar = "bar";
path_buf = PathBuf::fr... | 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/modulo_arithmetic_integral_const.rs | src/tools/clippy/tests/ui/modulo_arithmetic_integral_const.rs | #![warn(clippy::modulo_arithmetic)]
#![allow(
clippy::no_effect,
clippy::unnecessary_operation,
clippy::modulo_one,
clippy::identity_op
)]
fn main() {
// Lint when both sides are const and of the opposite sign
-1 % 2;
//~^ modulo_arithmetic
1 % -2;
//~^ modulo_arithmetic
(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/suspicious_else_formatting.rs | src/tools/clippy/tests/ui/suspicious_else_formatting.rs | //@aux-build:proc_macro_suspicious_else_formatting.rs
#![warn(clippy::suspicious_else_formatting, clippy::possible_missing_else)]
#![allow(
clippy::if_same_then_else,
clippy::let_unit_value,
clippy::needless_ifs,
clippy::needless_else
)]
extern crate proc_macro_suspicious_else_formatting;
use proc_mac... | 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/must_use_unit_unfixable.rs | src/tools/clippy/tests/ui/must_use_unit_unfixable.rs | #[cfg_attr(all(), must_use, deprecated)]
fn issue_12320() {}
//~^ must_use_unit
#[cfg_attr(all(), deprecated, doc = "foo", must_use)]
fn issue_12320_2() {}
//~^ must_use_unit
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/single_range_in_vec_init.rs | src/tools/clippy/tests/ui/single_range_in_vec_init.rs | //@aux-build:proc_macros.rs
#![allow(clippy::no_effect, clippy::unnecessary_operation, clippy::useless_vec, unused)]
#![warn(clippy::single_range_in_vec_init)]
#[macro_use]
extern crate proc_macros;
macro_rules! a {
() => {
vec![0..200];
};
}
fn awa<T: PartialOrd>(start: T, end: T) {
[start..end]... | 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_filter_is_ok.rs | src/tools/clippy/tests/ui/iter_filter_is_ok.rs | #![warn(clippy::iter_filter_is_ok)]
#![allow(
clippy::map_identity,
clippy::result_filter_map,
clippy::needless_borrow,
clippy::redundant_closure
)]
fn main() {
{
let _ = vec![Ok(1), Err(2), Ok(3)].into_iter().filter(Result::is_ok);
//~^ iter_filter_is_ok
let _ = vec![Ok(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/repl_uninit.rs | src/tools/clippy/tests/ui/repl_uninit.rs | #![allow(deprecated, invalid_value, clippy::uninit_assumed_init)]
#![warn(clippy::mem_replace_with_uninit)]
//@no-rustfix
use std::mem;
fn might_panic<X>(x: X) -> X {
// in practice this would be a possibly-panicky operation
x
}
fn main() {
let mut v = vec![0i32; 4];
// the following is UB if `might_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/seek_to_start_instead_of_rewind.rs | src/tools/clippy/tests/ui/seek_to_start_instead_of_rewind.rs | #![allow(unused)]
#![warn(clippy::seek_to_start_instead_of_rewind)]
use std::fs::OpenOptions;
use std::io::{Read, Seek, SeekFrom, Write};
struct StructWithSeekMethod {}
impl StructWithSeekMethod {
fn seek(&mut self, from: SeekFrom) {}
}
trait MySeekTrait {
fn seek(&mut self, from: SeekFrom) {}
}
struct Str... | 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_hypot.rs | src/tools/clippy/tests/ui/floating_point_hypot.rs | #![warn(clippy::imprecise_flops)]
fn main() {
let x = 3f32;
let y = 4f32;
let _ = (x * x + y * y).sqrt();
//~^ imprecise_flops
let _ = ((x + 1f32) * (x + 1f32) + y * y).sqrt();
//~^ imprecise_flops
let _ = (x.powi(2) + y.powi(2)).sqrt();
//~^ imprecise_flops
// Cases where the lint ... | 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_splitn.rs | src/tools/clippy/tests/ui/suspicious_splitn.rs | #![warn(clippy::suspicious_splitn)]
#![allow(clippy::needless_splitn)]
fn main() {
let _ = "a,b,c".splitn(3, ',');
let _ = [0, 1, 2, 1, 3].splitn(3, |&x| x == 1);
let _ = "".splitn(0, ',');
let _ = [].splitn(0, |&x: &u32| x == 1);
let _ = "a,b".splitn(0, ',');
//~^ suspicious_splitn
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/writeln_empty_string_unfixable.rs | src/tools/clippy/tests/ui/writeln_empty_string_unfixable.rs | #![allow(unused_must_use)]
#![warn(clippy::writeln_empty_string)]
use std::io::Write;
// If there is a comment in the span of macro call, we don't provide an auto-fix suggestion.
#[rustfmt::skip]
fn issue_16251() {
let mut v = Vec::new();
writeln!(v, /* comment */ "");
//~^ writeln_empty_string
writ... | 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/unsafe_derive_deserialize.rs | src/tools/clippy/tests/ui/unsafe_derive_deserialize.rs | #![warn(clippy::unsafe_derive_deserialize)]
#![allow(unused, clippy::missing_safety_doc)]
extern crate serde;
use serde::Deserialize;
#[derive(Deserialize)]
//~^ ERROR: you are deriving `serde::Deserialize` on a type that has methods using `unsafe
pub struct A;
impl A {
pub unsafe fn new(_a: i32, _b: i32) -> Sel... | 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_as_ptr.rs | src/tools/clippy/tests/ui/ptr_as_ptr.rs | //@aux-build:proc_macros.rs
#![warn(clippy::ptr_as_ptr)]
extern crate proc_macros;
use proc_macros::{external, inline_macros, with_span};
mod issue_11278_a {
#[derive(Debug)]
pub struct T<D: std::fmt::Debug + ?Sized> {
pub p: D,
}
}
mod issue_11278_b {
pub fn f(o: &mut super::issue_11278_a::... | 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_clone.rs | src/tools/clippy/tests/ui/redundant_clone.rs | // rustfix-only-machine-applicable
#![warn(clippy::redundant_clone)]
#![allow(
clippy::drop_non_drop,
clippy::implicit_clone,
clippy::pathbuf_init_then_push,
clippy::uninlined_format_args,
clippy::unnecessary_literal_unwrap
)]
use std::ffi::OsString;
use std::path::Path;
fn main() {
let _s = [... | 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/misrefactored_assign_op.rs | src/tools/clippy/tests/ui/misrefactored_assign_op.rs | #![allow(clippy::eq_op)]
#![warn(clippy::misrefactored_assign_op, clippy::assign_op_pattern)]
fn main() {
let mut a = 5;
a += a + 1;
//~^ misrefactored_assign_op
a += 1 + a;
//~^ misrefactored_assign_op
a -= a - 1;
//~^ misrefactored_assign_op
a *= a * 99;
//~^ misrefactored_assi... | 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/mut_key.rs | src/tools/clippy/tests/ui/mut_key.rs | use std::cell::Cell;
use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet};
use std::hash::{Hash, Hasher};
use std::rc::Rc;
use std::sync::Arc;
use std::sync::atomic::AtomicUsize;
use std::sync::atomic::Ordering::Relaxed;
struct Key(AtomicUsize);
impl Clone for Key {
fn clone(&self) -> Self {
Key(A... | 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_noautofix.rs | src/tools/clippy/tests/ui/redundant_test_prefix_noautofix.rs | //@no-rustfix: name conflicts
#![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() {
//~^ redu... | 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_str_repeat.rs | src/tools/clippy/tests/ui/manual_str_repeat.rs | #![allow(non_local_definitions, clippy::manual_repeat_n)]
#![warn(clippy::manual_str_repeat)]
use std::borrow::Cow;
use std::iter::repeat;
fn main() {
let _: String = std::iter::repeat("test").take(10).collect();
//~^ manual_str_repeat
let _: String = std::iter::repeat('x').take(10).collect();
//~^ ma... | 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_arithmetic_impl.rs | src/tools/clippy/tests/ui/suspicious_arithmetic_impl.rs | #![allow(clippy::legacy_numeric_constants)]
#![warn(clippy::suspicious_arithmetic_impl)]
use std::ops::{
Add, AddAssign, BitAnd, BitOr, BitOrAssign, BitXor, Div, DivAssign, Mul, MulAssign, Rem, Shl, Shr, Sub,
};
#[derive(Copy, Clone)]
struct Foo(u32);
impl Add for Foo {
type Output = Foo;
fn add(self, ot... | 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/search_is_some_fixable_some_2021.rs | src/tools/clippy/tests/ui/search_is_some_fixable_some_2021.rs | //@edition: 2021
#![warn(clippy::search_is_some)]
fn main() {
fn ref_bindings() {
let _ = [&(&1, 2), &(&3, 4), &(&5, 4)].iter().find(|(&x, y)| x == *y).is_some();
//~^ search_is_some
let _ = [&(&1, 2), &(&3, 4), &(&5, 4)].iter().find(|&(&x, y)| x == *y).is_some();
//~^ search_is_som... | 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_wraps.rs | src/tools/clippy/tests/ui/unnecessary_wraps.rs | //@no-rustfix: overlapping suggestions
#![warn(clippy::unnecessary_wraps)]
#![allow(clippy::no_effect)]
#![allow(clippy::needless_return)]
#![allow(clippy::if_same_then_else)]
#![allow(dead_code)]
// should be linted
fn func1(a: bool, b: bool) -> Option<i32> {
//~^ unnecessary_wraps
if a && b {
return... | 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/len_without_is_empty_expect.rs | src/tools/clippy/tests/ui/len_without_is_empty_expect.rs | //@no-rustfix
#![allow(clippy::len_without_is_empty)]
// Check that the lint expectation is fulfilled even if the lint is allowed at the type level.
pub struct Empty;
impl Empty {
#[expect(clippy::len_without_is_empty)]
pub fn len(&self) -> usize {
0
}
}
// Check that the lint expectation is not ... | 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_and_ref_as_ptr.rs | src/tools/clippy/tests/ui/borrow_and_ref_as_ptr.rs | // Make sure that `ref_as_ptr` is not emitted when `borrow_as_ptr` is.
#![warn(clippy::ref_as_ptr, clippy::borrow_as_ptr)]
fn f<T>(_: T) {}
fn main() {
let mut val = 0;
f(&val as *const _);
//~^ borrow_as_ptr
f(&mut val as *mut i32);
//~^ borrow_as_ptr
}
| 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/ifs_same_cond.rs | src/tools/clippy/tests/ui/ifs_same_cond.rs | #![warn(clippy::ifs_same_cond)]
#![allow(clippy::if_same_then_else, clippy::needless_ifs, clippy::needless_else)] // all empty blocks
fn ifs_same_cond() {
let a = 0;
let b = false;
if b {
//~^ ifs_same_cond
} else if b {
}
if b {
//~^ ifs_same_cond
} else if b {
} 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/manual_is_ascii_check.rs | src/tools/clippy/tests/ui/manual_is_ascii_check.rs | #![allow(unused, dead_code)]
#![warn(clippy::manual_is_ascii_check)]
fn main() {
assert!(matches!('x', 'a'..='z'));
//~^ manual_is_ascii_check
assert!(matches!('X', 'A'..='Z'));
//~^ manual_is_ascii_check
assert!(matches!(b'x', b'a'..=b'z'));
//~^ manual_is_ascii_check
assert!(matches!(b'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/manual_split_once.rs | src/tools/clippy/tests/ui/manual_split_once.rs | #![warn(clippy::manual_split_once)]
#![allow(unused, clippy::iter_skip_next, clippy::iter_nth_zero)]
extern crate itertools;
#[allow(unused_imports)]
use itertools::Itertools;
fn main() {
let _ = "key=value".splitn(2, '=').nth(2);
let _ = "key=value".splitn(2, '=').nth(1).unwrap();
//~^ manual_split_once... | 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_closure_call_early.rs | src/tools/clippy/tests/ui/redundant_closure_call_early.rs | // non rustfixable, see redundant_closure_call_fixable.rs
#![warn(clippy::redundant_closure_call)]
fn main() {
let mut i = 1;
// lint here
let mut k = (|m| m + 1)(i);
//~^ redundant_closure_call
// lint here
k = (|a, b| a * b)(1, 5);
//~^ redundant_closure_call
// don't lint these
... | 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/track-diagnostics.rs | src/tools/clippy/tests/ui/track-diagnostics.rs | //@compile-flags: -Z track-diagnostics
// Normalize the emitted location so this doesn't need
// updating everytime someone adds or removes a line.
//@normalize-stderr-test: ".rs:\d+:\d+" -> ".rs:LL:CC"
//@normalize-stderr-test: "/rustc-dev/[0-9a-f]+/" -> ""
struct A;
struct B;
const S: A = B;
//~^ ERROR: mismatched ... | 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/same_functions_in_if_condition.rs | src/tools/clippy/tests/ui/same_functions_in_if_condition.rs | #![feature(adt_const_params)]
#![deny(clippy::same_functions_in_if_condition)]
// ifs_same_cond warning is different from `ifs_same_cond`.
// clippy::if_same_then_else, clippy::comparison_chain -- all empty blocks
#![allow(incomplete_features)]
#![allow(clippy::if_same_then_else, clippy::ifs_same_cond, clippy::uninline... | 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/unused_format_specs.rs | src/tools/clippy/tests/ui/unused_format_specs.rs | #![warn(clippy::unused_format_specs)]
#![allow(unused)]
macro_rules! format_args_from_macro {
() => {
format_args!("from macro")
};
}
fn main() {
// prints `.`, not ` .`
println!("{:5}.", format_args!(""));
//~^ unused_format_specs
//prints `abcde`, not `abc`
println!("{:.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/transmute_undefined_repr.rs | src/tools/clippy/tests/ui/transmute_undefined_repr.rs | #![warn(clippy::transmute_undefined_repr)]
#![allow(
clippy::unit_arg,
clippy::transmute_ptr_to_ref,
clippy::useless_transmute,
clippy::missing_transmute_annotations
)]
use core::any::TypeId;
use core::ffi::c_void;
use core::mem::{MaybeUninit, size_of, transmute};
use core::ptr::NonNull;
fn value<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/nonminimal_bool.rs | src/tools/clippy/tests/ui/nonminimal_bool.rs | //@no-rustfix: overlapping suggestions
#![allow(
unused,
clippy::diverging_sub_expression,
clippy::needless_ifs,
clippy::redundant_pattern_matching
)]
#![warn(clippy::nonminimal_bool)]
#![allow(clippy::useless_vec)]
fn main() {
let a: bool = unimplemented!();
let b: bool = unimplemented!();
... | 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/exit4.rs | src/tools/clippy/tests/ui/exit4.rs | //@ check-pass
//@compile-flags: --test
#![warn(clippy::exit)]
fn main() {
std::process::exit(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_with_cast.rs | src/tools/clippy/tests/ui/ptr_offset_with_cast.rs | #![expect(clippy::unnecessary_cast, clippy::useless_vec, clippy::needless_borrow)]
fn main() {
let vec = vec![b'a', b'b', b'c'];
let ptr = vec.as_ptr();
let offset_u8 = 1_u8;
let offset_usize = 1_usize;
let offset_isize = 1_isize;
unsafe {
let _ = ptr.offset(offset_usize as isize);
... | 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_sort_by_no_std.rs | src/tools/clippy/tests/ui/unnecessary_sort_by_no_std.rs | #![no_std]
extern crate alloc;
use alloc::vec;
use alloc::vec::Vec;
fn issue_11524() -> Vec<i32> {
let mut vec = vec![1, 2, 3];
// Should lint and suggest `vec.sort_by_key(|a| a + 1);`
vec.sort_by(|a, b| (a + 1).cmp(&(b + 1)));
//~^ unnecessary_sort_by
vec
}
fn issue_11524_2() -> Vec<i32> {
l... | 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_add.rs | src/tools/clippy/tests/ui/string_add.rs | //@aux-build:proc_macros.rs
//@no-rustfix
extern crate proc_macros;
use proc_macros::external;
#[warn(clippy::string_add)]
#[allow(clippy::assign_op_pattern, clippy::string_add_assign, unused)]
fn main() {
// ignores assignment distinction
let mut x = String::new();
for _ in 1..3 {
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/string_add_assign.rs | src/tools/clippy/tests/ui/string_add_assign.rs | #[allow(clippy::string_add, unused)]
#[warn(clippy::string_add_assign)]
fn main() {
// ignores assignment distinction
let mut x = String::new();
for _ in 1..3 {
x = x + ".";
//~^ string_add_assign
//~| assign_op_pattern
}
let y = String::new();
let z = y + "...";
a... | 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/useful_asref.rs | src/tools/clippy/tests/ui/useful_asref.rs | //@ check-pass
#![deny(clippy::useless_asref)]
#![allow(clippy::needless_lifetimes)]
trait Trait {
fn as_ptr(&self);
}
impl<'a> Trait for &'a [u8] {
fn as_ptr(&self) {
self.as_ref().as_ptr();
}
}
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/octal_escapes.rs | src/tools/clippy/tests/ui/octal_escapes.rs | //@no-rustfix: overlapping suggestions
#![warn(clippy::octal_escapes)]
fn main() {
let _bad1 = "\033[0m";
//~^ octal_escapes
let _bad2 = b"\033[0m";
//~^ octal_escapes
let _bad3 = "\\\033[0m";
//~^ octal_escapes
// maximum 3 digits (\012 is the escape)
let _bad4 = "\01234567";
//~^ ... | 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/use_self_trait.rs | src/tools/clippy/tests/ui/use_self_trait.rs | #![warn(clippy::use_self)]
#![allow(dead_code)]
#![allow(clippy::should_implement_trait, clippy::boxed_local)]
use std::ops::Mul;
trait SelfTrait {
fn refs(p1: &Self) -> &Self;
fn ref_refs<'a>(p1: &'a &'a Self) -> &'a &'a Self;
fn mut_refs(p1: &mut Self) -> &mut Self;
fn nested(p1: Box<Self>, p2: (&u8... | 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/trait_duplication_in_bounds_assoc_const_eq.rs | src/tools/clippy/tests/ui/trait_duplication_in_bounds_assoc_const_eq.rs | #![deny(clippy::trait_duplication_in_bounds)]
#![expect(incomplete_features)]
#![feature(associated_const_equality, min_generic_const_args)]
trait AssocConstTrait {
#[type_const]
const ASSOC: usize;
}
fn assoc_const_args<T>()
where
T: AssocConstTrait<ASSOC = 0> + AssocConstTrait<ASSOC = 0>,
//~^ trait_... | 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_inline.rs | src/tools/clippy/tests/ui/missing_inline.rs | #![warn(clippy::missing_inline_in_public_items)]
#![crate_type = "dylib"]
// When denying at the crate level, be sure to not get random warnings from the
// injected intrinsics by the compiler.
#![allow(dead_code, non_snake_case)]
type Typedef = String;
pub type PubTypedef = String;
struct Foo; // ok
pub struct PubFo... | 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/min_rust_version_attr.rs | src/tools/clippy/tests/ui/min_rust_version_attr.rs | #![allow(clippy::redundant_clone)]
#![feature(custom_inner_attributes)]
fn main() {}
#[clippy::msrv = "1.42.0"]
fn just_under_msrv() {
let log2_10 = 3.321928094887362;
}
#[clippy::msrv = "1.43.0"]
fn meets_msrv() {
let log2_10 = 3.321928094887362;
//~^ approx_constant
}
#[clippy::msrv = "1.44.0"]
fn jus... | 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/confusing_method_to_numeric_cast.rs | src/tools/clippy/tests/ui/confusing_method_to_numeric_cast.rs | #![feature(float_minimum_maximum)]
#![warn(clippy::confusing_method_to_numeric_cast)]
#![allow(function_casts_as_integer)]
fn main() {
let _ = u16::max as usize; //~ confusing_method_to_numeric_cast
let _ = u16::min as usize; //~ confusing_method_to_numeric_cast
let _ = u16::max_value as usize; //~ confusi... | 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/implied_bounds_in_impls.rs | src/tools/clippy/tests/ui/implied_bounds_in_impls.rs | #![warn(clippy::implied_bounds_in_impls)]
#![allow(dead_code)]
#![feature(impl_trait_in_assoc_type, type_alias_impl_trait)]
use std::ops::{Deref, DerefMut};
// Only one bound, nothing to lint.
fn normal_deref<T>(x: T) -> impl Deref<Target = T> {
Box::new(x)
}
// Deref implied by DerefMut
fn deref_derefmut<T>(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/same_item_push.rs | src/tools/clippy/tests/ui/same_item_push.rs | #![warn(clippy::same_item_push)]
const VALUE: u8 = 7;
fn mutate_increment(x: &mut u8) -> u8 {
*x += 1;
*x
}
fn increment(x: u8) -> u8 {
x + 1
}
fn fun() -> usize {
42
}
fn main() {
// ** linted cases **
let mut vec: Vec<u8> = Vec::new();
let item = 2;
for _ in 5..=20 {
vec.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/cmp_null.rs | src/tools/clippy/tests/ui/cmp_null.rs | #![warn(clippy::cmp_null)]
use std::ptr;
fn main() {
let x = 0;
let p: *const usize = &x;
if p == ptr::null() {
//~^ cmp_null
println!("This is surprising!");
}
if ptr::null() == p {
//~^ cmp_null
println!("This is surprising!");
}
let mut y = 0;
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/borrow_box.rs | src/tools/clippy/tests/ui/borrow_box.rs | #![deny(clippy::borrowed_box)]
#![allow(dead_code, unused_variables)]
#![allow(
clippy::uninlined_format_args,
clippy::disallowed_names,
clippy::needless_pass_by_ref_mut,
clippy::needless_lifetimes
)]
use std::fmt::Display;
pub fn test1(foo: &mut Box<bool>) {
// Although this function could be cha... | 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/unit_cmp.rs | src/tools/clippy/tests/ui/unit_cmp.rs | #![warn(clippy::unit_cmp)]
#![allow(
clippy::no_effect,
clippy::unnecessary_operation,
clippy::derive_partial_eq_without_eq,
clippy::needless_ifs
)]
#[derive(PartialEq)]
pub struct ContainsUnit(()); // should be fine
fn main() {
// this is fine
if true == false {}
// this warns
if {
... | 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_map.rs | src/tools/clippy/tests/ui/suspicious_map.rs | #![allow(clippy::map_with_unused_argument_over_ranges)]
#![warn(clippy::suspicious_map)]
fn main() {
let _ = (0..3).map(|x| x + 2).count();
//~^ suspicious_map
let f = |x| x + 1;
let _ = (0..3).map(f).count();
//~^ suspicious_map
}
fn negative() {
// closure with side effects
let mut sum ... | 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_canonical_partial_ord_impl.rs | src/tools/clippy/tests/ui/non_canonical_partial_ord_impl.rs | //@aux-build:proc_macro_derive.rs
#![no_main]
extern crate proc_macros;
use proc_macros::inline_macros;
use std::cmp::Ordering;
// lint
#[derive(Eq, PartialEq)]
struct A(u32);
impl Ord for A {
fn cmp(&self, other: &Self) -> Ordering {
todo!();
}
}
impl PartialOrd for A {
//~^ non_canonical_par... | 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_unfixable.rs | src/tools/clippy/tests/ui/cast_lossless_integer_unfixable.rs | //@check-pass
#![warn(clippy::cast_lossless)]
fn issue15348() {
macro_rules! zero {
($int:ty) => {{
let data: [u8; 3] = [0, 0, 0];
data[0] as $int
}};
}
let _ = zero!(u8);
let _ = zero!(u16);
let _ = zero!(u32);
let _ = zero!(u64);
let _ = zero!(u128... | 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/renamed_builtin_attr.rs | src/tools/clippy/tests/ui/renamed_builtin_attr.rs | //@compile-flags: -Zdeduplicate-diagnostics=yes
#[clippy::cyclomatic_complexity = "1"]
//~^ ERROR: usage of deprecated attribute
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_arbitrary_self_type_unfixable.rs | src/tools/clippy/tests/ui/needless_arbitrary_self_type_unfixable.rs | //@aux-build:proc_macro_attr.rs
#![warn(clippy::needless_arbitrary_self_type)]
#[macro_use]
extern crate proc_macro_attr;
mod issue_6089 {
// Check that we don't lint if the `self` parameter comes from expansion
macro_rules! test_from_expansion {
() => {
trait T1 {
fn tes... | 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/to_digit_is_some.rs | src/tools/clippy/tests/ui/to_digit_is_some.rs | #![warn(clippy::to_digit_is_some)]
fn main() {
let c = 'x';
let d = &c;
let _ = d.to_digit(8).is_some();
//~^ to_digit_is_some
let _ = char::to_digit(c, 8).is_some();
//~^ to_digit_is_some
}
#[clippy::msrv = "1.86"]
mod cannot_lint_in_const_context {
fn without_const(c: char) -> bool {
... | 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/double_parens.rs | src/tools/clippy/tests/ui/double_parens.rs | //@aux-build:proc_macros.rs
//@aux-build:proc_macro_derive.rs
//@aux-build:macro_rules.rs
#![warn(clippy::double_parens)]
#![expect(clippy::eq_op, clippy::no_effect)]
#![feature(custom_inner_attributes)]
#![rustfmt::skip]
use proc_macros::{external, with_span};
fn dummy_fn<T>(_: T) {}
struct DummyStruct;
impl Dummy... | 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/eager_transmute.rs | src/tools/clippy/tests/ui/eager_transmute.rs | #![feature(rustc_attrs)]
#![warn(clippy::eager_transmute)]
#![allow(clippy::transmute_int_to_non_zero, clippy::missing_transmute_annotations)]
use std::num::NonZero;
#[repr(u8)]
enum Opcode {
Add = 0,
Sub = 1,
Mul = 2,
Div = 3,
}
struct Data {
foo: &'static [u8],
bar: &'static [u8],
}
fn 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/unnecessary_to_owned.rs | src/tools/clippy/tests/ui/unnecessary_to_owned.rs | #![allow(
clippy::manual_async_fn,
clippy::needless_borrow,
clippy::needless_borrows_for_generic_args,
clippy::needless_lifetimes,
clippy::owned_cow,
clippy::ptr_arg,
clippy::uninlined_format_args
)]
#![warn(clippy::unnecessary_to_owned, clippy::redundant_clone)]
use std::borrow::Cow;
use s... | 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_raw_slice_pointer_cast.rs | src/tools/clippy/tests/ui/cast_raw_slice_pointer_cast.rs | #![warn(clippy::cast_slice_from_raw_parts)]
const fn require_raw_slice_ptr<T>(_: *const [T]) {}
fn main() {
let mut vec = vec![0u8; 1];
let ptr: *const u8 = vec.as_ptr();
let mptr = vec.as_mut_ptr();
let _: *const [u8] = unsafe { std::slice::from_raw_parts(ptr, 1) as *const [u8] };
//~^ cast_slice... | 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_command_arg_space.rs | src/tools/clippy/tests/ui/suspicious_command_arg_space.rs | #![allow(clippy::zombie_processes)]
fn main() {
// Things it should warn about:
std::process::Command::new("echo").arg("-n hello").spawn().unwrap();
//~^ suspicious_command_arg_space
std::process::Command::new("cat").arg("--number file").spawn().unwrap();
//~^ suspicious_command_arg_space
// 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/checked_conversions.rs | src/tools/clippy/tests/ui/checked_conversions.rs | #![allow(
clippy::cast_lossless,
clippy::legacy_numeric_constants,
unused,
// Int::max_value will be deprecated in the future
deprecated,
)]
#![warn(clippy::checked_conversions)]
// Positive tests
// Signed to unsigned
pub fn i64_to_u32(value: i64) {
let _ = value <= (u32::max_value() as i64)... | 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/option_env_unwrap.rs | src/tools/clippy/tests/ui/option_env_unwrap.rs | //@aux-build:proc_macros.rs
#![warn(clippy::option_env_unwrap)]
#![allow(clippy::map_flatten)]
extern crate proc_macros;
use proc_macros::{external, inline_macros};
#[inline_macros]
fn main() {
let _ = option_env!("PATH").unwrap();
//~^ option_env_unwrap
let _ = option_env!("PATH").expect("environment var... | 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/invalid_upcast_comparisons.rs | src/tools/clippy/tests/ui/invalid_upcast_comparisons.rs | #![warn(clippy::invalid_upcast_comparisons)]
#![allow(
unused,
clippy::eq_op,
clippy::no_effect,
clippy::unnecessary_operation,
clippy::cast_lossless
)]
fn mk_value<T>() -> T {
unimplemented!()
}
fn main() {
let u32: u32 = mk_value();
let u8: u8 = mk_value();
let i32: i32 = mk_valu... | 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/inconsistent_struct_constructor.rs | src/tools/clippy/tests/ui/inconsistent_struct_constructor.rs | //@aux-build:proc_macros.rs
#![warn(clippy::inconsistent_struct_constructor)]
#![allow(clippy::redundant_field_names)]
#![allow(clippy::unnecessary_operation)]
#![allow(clippy::no_effect)]
#![allow(dead_code)]
extern crate proc_macros;
#[derive(Default)]
struct Foo {
x: i32,
y: i32,
z: i32,
}
#[derive(D... | 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/exit1_compile_flag_test.rs | src/tools/clippy/tests/ui/exit1_compile_flag_test.rs | //@compile-flags: --test
#![warn(clippy::exit)]
fn not_main() {
if true {
std::process::exit(4);
//~^ exit
}
}
fn main() {
if true {
std::process::exit(2);
};
not_main();
std::process::exit(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/comparison_chain.rs | src/tools/clippy/tests/ui/comparison_chain.rs | //@no-rustfix: has placeholders
#![allow(dead_code)]
#![warn(clippy::comparison_chain)]
fn a() {}
fn b() {}
fn c() {}
fn f(x: u8, y: u8, z: u8) {
// Ignored: Only one branch
if x > y {
a()
}
// Ignored: Not all cases are covered
if x < y {
a()
} else if x > y {
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/sliced_string_as_bytes.rs | src/tools/clippy/tests/ui/sliced_string_as_bytes.rs | #![allow(unused)]
#![warn(clippy::sliced_string_as_bytes)]
use std::ops::{Index, Range};
struct Foo;
struct Bar;
impl Bar {
fn as_bytes(&self) -> &[u8] {
&[0, 1, 2, 3]
}
}
impl Index<Range<usize>> for Foo {
type Output = Bar;
fn index(&self, _: Range<usize>) -> &Self::Output {
&Bar... | 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/as_conversions.rs | src/tools/clippy/tests/ui/as_conversions.rs | //@aux-build:proc_macros.rs
#![warn(clippy::as_conversions)]
#![allow(clippy::borrow_as_ptr, unused)]
extern crate proc_macros;
use proc_macros::{external, with_span};
fn main() {
let i = 0u32 as u64; //~ as_conversions
let j = &i as *const u64 as *mut u64;
//~^ as_conversions
//~| as_conversions
... | 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_result.rs | src/tools/clippy/tests/ui/redundant_pattern_matching_result.rs | #![warn(clippy::redundant_pattern_matching)]
#![allow(deprecated)]
#![allow(
clippy::if_same_then_else,
clippy::match_like_matches_macro,
clippy::needless_bool,
clippy::needless_ifs,
clippy::uninlined_format_args,
clippy::unnecessary_wraps
)]
fn main() {
let result: Result<usize, usize> = E... | 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/disallowed_names.rs | src/tools/clippy/tests/ui/disallowed_names.rs | //@aux-build:proc_macros.rs
#![allow(
dead_code,
clippy::needless_ifs,
clippy::similar_names,
clippy::single_match,
clippy::toplevel_ref_arg,
unused_mut,
unused_variables
)]
#![warn(clippy::disallowed_names)]
extern crate proc_macros;
use proc_macros::{external, with_span};
fn test(foo: ()... | 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/char_lit_as_u8_unfixable.rs | src/tools/clippy/tests/ui/char_lit_as_u8_unfixable.rs | #![warn(clippy::char_lit_as_u8)]
fn main() {
// no suggestion, since a byte literal won't work.
let _ = '❤' as u8;
//~^ char_lit_as_u8
}
| 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/arc_with_non_send_sync.rs | src/tools/clippy/tests/ui/arc_with_non_send_sync.rs | //@aux-build:proc_macros.rs
#![warn(clippy::arc_with_non_send_sync)]
#![allow(unused_variables)]
#[macro_use]
extern crate proc_macros;
use std::cell::RefCell;
use std::ptr::{null, null_mut};
use std::sync::{Arc, Mutex};
fn foo<T>(x: T) {
// Should not lint - purposefully ignoring generic args.
let a = Arc::... | 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/deref_addrof.rs | src/tools/clippy/tests/ui/deref_addrof.rs | #![allow(
dangerous_implicit_autorefs,
clippy::explicit_auto_deref,
clippy::return_self_not_must_use,
clippy::useless_vec
)]
#![warn(clippy::deref_addrof)]
fn get_number() -> usize {
10
}
fn get_reference(n: &usize) -> &usize {
n
}
#[allow(clippy::double_parens)]
#[allow(unused_variables, unu... | 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/rc_mutex.rs | src/tools/clippy/tests/ui/rc_mutex.rs | #![warn(clippy::rc_mutex)]
#![allow(unused, clippy::disallowed_names)]
use std::rc::Rc;
use std::sync::Mutex;
pub struct MyStructWithPrivItem {
foo: Rc<Mutex<i32>>,
//~^ rc_mutex
}
pub struct MyStructWithPubItem {
pub foo: Rc<Mutex<i32>>,
}
pub struct SubT<T> {
foo: T,
}
pub enum MyEnum {
One,
... | 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_bool_then_unfixable.rs | src/tools/clippy/tests/ui/filter_map_bool_then_unfixable.rs | #![allow(clippy::question_mark)]
#![warn(clippy::filter_map_bool_then)]
fn issue11617() {
let mut x: Vec<usize> = vec![0; 10];
let _ = (0..x.len()).zip(x.clone().iter()).filter_map(|(i, v)| {
//~^ filter_map_bool_then
(x[i] != *v).then(|| {
x[i] = i;
i
})
});... | 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/methods.rs | src/tools/clippy/tests/ui/methods.rs | //@aux-build:option_helpers.rs
#![allow(
clippy::disallowed_names,
clippy::default_trait_access,
clippy::let_underscore_untyped,
clippy::missing_docs_in_private_items,
clippy::missing_safety_doc,
clippy::non_ascii_literal,
clippy::new_without_default,
clippy::needless_pass_by_value,
... | 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_octal_unix_permissions.rs | src/tools/clippy/tests/ui/non_octal_unix_permissions.rs | //@ignore-target: windows
#![warn(clippy::non_octal_unix_permissions)]
use std::fs::{DirBuilder, File, OpenOptions, Permissions};
use std::os::unix::fs::{DirBuilderExt, OpenOptionsExt, PermissionsExt};
fn main() {
let permissions = 0o760;
// OpenOptionsExt::mode
let mut options = OpenOptions::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/inefficient_to_string.rs | src/tools/clippy/tests/ui/inefficient_to_string.rs | #![deny(clippy::inefficient_to_string)]
use std::borrow::Cow;
#[clippy::msrv = "1.81"]
fn main() {
let rstr: &str = "hello";
let rrstr: &&str = &rstr;
let rrrstr: &&&str = &rrstr;
let _: String = rstr.to_string();
let _: String = rrstr.to_string();
//~^ inefficient_to_string
let _: 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/panic_in_result_fn.rs | src/tools/clippy/tests/ui/panic_in_result_fn.rs | #![warn(clippy::panic_in_result_fn)]
#![allow(clippy::unnecessary_wraps)]
struct A;
impl A {
fn result_with_panic() -> Result<bool, String> // should emit lint
//~^ panic_in_result_fn
{
panic!("error");
}
fn result_with_unimplemented() -> Result<bool, String> // should emit lint
{
... | 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_with_drain.rs | src/tools/clippy/tests/ui/iter_with_drain.rs | // will emits unused mut warnings after fixing
#![allow(unused_mut)]
// will emits needless collect warnings after fixing
#![allow(clippy::needless_collect, clippy::drain_collect)]
#![warn(clippy::iter_with_drain)]
use std::collections::{BinaryHeap, HashMap, HashSet, VecDeque};
fn full() {
let mut a = vec!["aaa".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/redundant_locals.rs | src/tools/clippy/tests/ui/redundant_locals.rs | //@aux-build:proc_macros.rs
#![allow(unused, clippy::no_effect, clippy::needless_pass_by_ref_mut)]
#![warn(clippy::redundant_locals)]
#![feature(coroutines, stmt_expr_attributes)]
extern crate proc_macros;
use proc_macros::{external, with_span};
fn main() {}
fn immutable() {
let x = 1;
let x = x;
//~^ 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/rename.rs | src/tools/clippy/tests/ui/rename.rs | // This file was generated by `cargo dev update_lints`.
// Use that command to update this file and do not edit by hand.
// Manual edits will be overwritten.
#![allow(clippy::duplicated_attributes)]
#![allow(clippy::almost_complete_range)]
#![allow(clippy::disallowed_names)]
#![allow(clippy::blocks_in_conditions)]
#![... | 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_trait_methods.rs | src/tools/clippy/tests/ui/missing_trait_methods.rs | #![allow(unused, clippy::needless_lifetimes)]
#![warn(clippy::missing_trait_methods)]
trait A {
fn provided() {}
}
trait B {
fn required();
fn a(_: usize) -> usize {
1
}
fn b<'a, T: AsRef<[u8]>>(a: &'a T) -> &'a [u8] {
a.as_ref()
}
}
struct Partial;
impl A for Partial {}
//... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.