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/impl.rs | src/tools/clippy/tests/ui/impl.rs | #![allow(dead_code, clippy::extra_unused_lifetimes)]
#![warn(clippy::multiple_inherent_impl)]
struct MyStruct;
impl MyStruct {
fn first() {}
}
impl MyStruct {
//~^ multiple_inherent_impl
fn second() {}
}
impl<'a> MyStruct {
fn lifetimed() {}
}
mod submod {
struct MyStruct;
impl MyStruct {
... | 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_string_trait_impl.rs | src/tools/clippy/tests/ui/to_string_trait_impl.rs | #![warn(clippy::to_string_trait_impl)]
#![feature(min_specialization)]
use std::fmt::{self, Display};
struct Point {
x: usize,
y: usize,
}
impl ToString for Point {
//~^ to_string_trait_impl
fn to_string(&self) -> String {
format!("({}, {})", self.x, self.y)
}
}
struct Foo;
impl 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/default_numeric_fallback_f64.rs | src/tools/clippy/tests/ui/default_numeric_fallback_f64.rs | //@aux-build:proc_macros.rs
#![warn(clippy::default_numeric_fallback)]
#![allow(
unused,
clippy::never_loop,
clippy::no_effect,
clippy::unnecessary_operation,
clippy::branches_sharing_code,
clippy::match_single_binding,
clippy::let_unit_value,
clippy::let_with_type_underscore
)]
extern... | 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/cfg_attr_cargo_clippy.rs | src/tools/clippy/tests/ui/cfg_attr_cargo_clippy.rs | #![warn(clippy::deprecated_clippy_cfg_attr)]
#![allow(clippy::non_minimal_cfg)]
#![cfg_attr(feature = "cargo-clippy", doc = "a")]
//~^ deprecated_clippy_cfg_attr
#[cfg_attr(feature = "cargo-clippy", derive(Debug))]
//~^ deprecated_clippy_cfg_attr
#[cfg_attr(not(feature = "cargo-clippy"), derive(Debug))]
//~^ deprecate... | 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_find_map.rs | src/tools/clippy/tests/ui/unnecessary_find_map.rs | fn main() {
let _ = (0..4).find_map(|x| if x > 1 { Some(x) } else { None });
//~^ unnecessary_find_map
let _ = (0..4).find_map(|x| {
//~^ unnecessary_find_map
if x > 1 {
return Some(x);
};
None
});
let _ = (0..4).find_map(|x| match x {
//~^ unnec... | 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_from_utf8_as_bytes.rs | src/tools/clippy/tests/ui/string_from_utf8_as_bytes.rs | #![warn(clippy::string_from_utf8_as_bytes)]
fn main() {
let _ = std::str::from_utf8(&"Hello World!".as_bytes()[6..11]);
//~^ string_from_utf8_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/nonminimal_bool_methods.rs | src/tools/clippy/tests/ui/nonminimal_bool_methods.rs | #![allow(unused, clippy::diverging_sub_expression, clippy::needless_ifs)]
#![warn(clippy::nonminimal_bool)]
fn methods_with_negation() {
let a: Option<i32> = unimplemented!();
let b: Result<i32, i32> = unimplemented!();
let _ = a.is_some();
let _ = !a.is_some();
//~^ nonminimal_bool
let _ = a.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/unwrap_in_result.rs | src/tools/clippy/tests/ui/unwrap_in_result.rs | #![warn(clippy::unwrap_in_result)]
#![allow(clippy::ok_expect)]
struct A;
impl A {
// should not be detected
fn good_divisible_by_3(i_str: String) -> Result<bool, String> {
// checks whether a string represents a number divisible by 3
let i_result = i_str.parse::<i32>();
match i_result... | 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_option.rs | src/tools/clippy/tests/ui/redundant_pattern_matching_option.rs | #![feature(if_let_guard)]
#![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
)]
fn issue_11174<T>(boolean: bool, maybe_some: Option<T>) -> bool {
matches!(maybe... | 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_pattern_char_comparison.rs | src/tools/clippy/tests/ui/manual_pattern_char_comparison.rs | #![warn(clippy::manual_pattern_char_comparison)]
struct NotStr;
impl NotStr {
fn find(&self, _: impl FnMut(char) -> bool) {}
}
fn main() {
let sentence = "Hello, world!";
sentence.trim_end_matches(|c: char| c == '.' || c == ',' || c == '!' || c == '?');
//~^ manual_pattern_char_comparison
sentenc... | 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/range_unfixable.rs | src/tools/clippy/tests/ui/range_unfixable.rs | //@no-rustfix
#![allow(clippy::useless_vec)]
#[warn(clippy::range_zip_with_len)]
fn main() {
let v1: Vec<u64> = vec![1, 2, 3];
let v2: Vec<u64> = vec![4, 5];
// Do not autofix, `filter()` would not consume the iterator.
//~v range_zip_with_len
v1.iter().zip(0..v1.len()).filter(|(_, i)| *i < 2).for_... | 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_docs.rs | src/tools/clippy/tests/ui/empty_docs.rs | //@aux-build:proc_macro_attr.rs
#![allow(unused)]
#![warn(clippy::empty_docs)]
#![allow(clippy::mixed_attributes_style)]
#![feature(extern_types)]
mod outer {
//!
//~^ empty_docs
/// this is a struct
struct Bananas {
/// count
count: usize,
}
///
//~^ empty_docs
enum ... | 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/mem_replace_no_std.rs | src/tools/clippy/tests/ui/mem_replace_no_std.rs | #![allow(unused, clippy::needless_lifetimes)]
#![warn(
clippy::style,
clippy::mem_replace_option_with_none,
clippy::mem_replace_with_default
)]
#![feature(lang_items)]
#![no_std]
use core::mem;
use core::panic::PanicInfo;
#[lang = "eh_personality"]
extern "C" fn eh_personality() {}
#[panic_handler]
fn pa... | 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_to_empty.rs | src/tools/clippy/tests/ui/comparison_to_empty.rs | #![warn(clippy::comparison_to_empty)]
#![allow(clippy::borrow_deref_ref, clippy::needless_ifs, clippy::useless_vec)]
fn main() {
// Disallow comparisons to empty
let s = String::new();
let _ = s == "";
//~^ comparison_to_empty
let _ = s != "";
//~^ comparison_to_empty
let v = vec![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/unnecessary_semicolon_feature_stmt_expr_attributes.rs | src/tools/clippy/tests/ui/unnecessary_semicolon_feature_stmt_expr_attributes.rs | #![warn(clippy::unnecessary_semicolon)]
#![feature(stmt_expr_attributes)]
fn main() {
// removing the `;` would turn the stmt into an expr, but attrs aren't allowed on exprs
// -- unless the feature `stmt_expr_attributes` is enabled
#[rustfmt::skip]
match 0 {
0b00 => {} 0b01 => {}
0b11... | 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/tests_outside_test_module.rs | src/tools/clippy/tests/ui/tests_outside_test_module.rs | //@require-annotations-for-level: WARN
#![allow(unused)]
#![warn(clippy::tests_outside_test_module)]
fn main() {
// test code goes here
}
// Should lint
#[test]
fn my_test() {}
//~^ ERROR: this function marked with #[test] is outside a #[cfg(test)] module
//~| NOTE: move it to a testing module marked with #[cfg(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/question_mark.rs | src/tools/clippy/tests/ui/question_mark.rs | #![feature(try_blocks)]
#![allow(clippy::unnecessary_wraps)]
use std::sync::MutexGuard;
fn some_func(a: Option<u32>) -> Option<u32> {
if a.is_none() {
//~^ question_mark
return None;
}
a
}
fn some_other_func(a: Option<u32>) -> Option<u32> {
if a.is_none() {
return None;
}... | 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/unreadable_literal.rs | src/tools/clippy/tests/ui/unreadable_literal.rs | #![warn(clippy::unreadable_literal)]
struct Foo(u64);
macro_rules! foo {
() => {
Foo(123123123123)
};
}
struct Bar(f32);
macro_rules! bar {
() => {
Bar(100200300400.100200300400500)
};
}
fn main() {
let _good = (
0b1011_i64,
0o1_234_u32,
0x1_234_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/lines_filter_map_ok.rs | src/tools/clippy/tests/ui/lines_filter_map_ok.rs | #![allow(clippy::map_identity)]
#![warn(clippy::lines_filter_map_ok)]
use std::io::{self, BufRead, BufReader};
fn main() -> io::Result<()> {
// Lint:
let f = std::fs::File::open("/")?;
BufReader::new(f).lines().filter_map(Result::ok).for_each(|_| ());
//~^ lines_filter_map_ok
let f = std::fs::Fil... | 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.rs | src/tools/clippy/tests/ui/use_self.rs | //@aux-build:proc_macro_derive.rs
#![warn(clippy::use_self)]
#![allow(dead_code, unreachable_code)]
#![allow(
clippy::should_implement_trait,
clippy::upper_case_acronyms,
clippy::from_over_into,
clippy::self_named_constructors,
clippy::needless_lifetimes,
clippy::missing_transmute_annotations
)... | 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/unchecked_time_subtraction_unfixable.rs | src/tools/clippy/tests/ui/unchecked_time_subtraction_unfixable.rs | #![warn(clippy::unchecked_time_subtraction)]
//@no-rustfix
use std::time::{Duration, Instant};
fn main() {
let dur1 = Duration::from_secs(5);
let dur2 = Duration::from_secs(3);
let dur3 = Duration::from_secs(1);
// Chained Duration subtraction - should lint without suggestion due to complexity
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/toplevel_ref_arg.rs | src/tools/clippy/tests/ui/toplevel_ref_arg.rs | //@aux-build:proc_macros.rs
#![warn(clippy::toplevel_ref_arg)]
#![allow(clippy::uninlined_format_args, unused, clippy::useless_vec)]
extern crate proc_macros;
use proc_macros::{external, inline_macros};
#[inline_macros]
fn main() {
// Closures should not warn
let y = |ref x| println!("{:?}", x);
y(1u8);
... | 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_then_some_else_none.rs | src/tools/clippy/tests/ui/if_then_some_else_none.rs | #![warn(clippy::if_then_some_else_none)]
#![allow(clippy::redundant_pattern_matching, clippy::unnecessary_lazy_evaluations)]
fn main() {
// Should issue an error.
let _ = if foo() {
//~^ if_then_some_else_none
println!("true!");
Some("foo")
} else {
None
};
// Shou... | 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_on_empty_collections.rs | src/tools/clippy/tests/ui/iter_on_empty_collections.rs | #![warn(clippy::iter_on_empty_collections)]
#![allow(clippy::iter_next_slice, clippy::redundant_clone)]
fn array() {
assert_eq!([].into_iter().next(), Option::<i32>::None);
//~^ iter_on_empty_collections
assert_eq!([].iter_mut().next(), Option::<&mut i32>::None);
//~^ iter_on_empty_collections
asse... | 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.rs | src/tools/clippy/tests/ui/search_is_some.rs | //@aux-build:option_helpers.rs
#![warn(clippy::search_is_some)]
#![allow(clippy::manual_pattern_char_comparison)]
#![allow(clippy::useless_vec)]
#![allow(dead_code)]
extern crate option_helpers;
use option_helpers::IteratorFalsePositives;
//@no-rustfix
#[rustfmt::skip]
fn main() {
// Check that we don't lint if the... | 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_owned_empty_strings.rs | src/tools/clippy/tests/ui/unnecessary_owned_empty_strings.rs | #![warn(clippy::unnecessary_owned_empty_strings)]
fn ref_str_argument(_value: &str) {}
#[allow(clippy::ptr_arg)]
fn ref_string_argument(_value: &String) {}
fn main() {
// should be linted
ref_str_argument(&String::new());
//~^ unnecessary_owned_empty_strings
// should be linted
#[allow(clippy::m... | 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/issue-3145.rs | src/tools/clippy/tests/ui/issue-3145.rs | fn main() {
println!("{}" a); //~ERROR: expected `,`, found `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/manual_map_option.rs | src/tools/clippy/tests/ui/manual_map_option.rs | #![warn(clippy::manual_map)]
#![allow(
clippy::no_effect,
clippy::map_identity,
clippy::unit_arg,
clippy::match_ref_pats,
clippy::redundant_pattern_matching,
clippy::unnecessary_map_on_constructor,
for_loops_over_fallibles,
dead_code
)]
fn main() {
match Some(0) {
//~^ manua... | 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_one.rs | src/tools/clippy/tests/ui/modulo_one.rs | #![warn(clippy::modulo_one)]
#![allow(unconditional_panic)]
#![allow(clippy::no_effect, clippy::unnecessary_operation, clippy::identity_op)]
static STATIC_ONE: usize = 2 - 1;
static STATIC_NEG_ONE: i64 = 1 - 2;
fn main() {
10 % 1;
//~^ modulo_one
10 % -1;
//~^ modulo_one
10 % 2;
// also caug... | 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_trait_names.rs | src/tools/clippy/tests/ui/unused_trait_names.rs | //@aux-build:proc_macros.rs
#![allow(unused)]
#![warn(clippy::unused_trait_names)]
#![feature(decl_macro)]
extern crate proc_macros;
fn main() {}
fn bad() {
use std::any::Any;
//~^ unused_trait_names
println!("{:?}", "foo".type_id());
}
fn good() {
use std::any::Any as _;
println!("{:?}", "fo... | 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/entry.rs | src/tools/clippy/tests/ui/entry.rs | //@needs-asm-support
#![allow(unused, clippy::needless_pass_by_value, clippy::collapsible_if)]
#![warn(clippy::map_entry)]
use std::arch::asm;
use std::collections::HashMap;
use std::hash::Hash;
macro_rules! m {
($e:expr) => {{ $e }};
}
macro_rules! insert {
($map:expr, $key:expr, $val:expr) => {
$m... | 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_safety_comment.rs | src/tools/clippy/tests/ui/unnecessary_safety_comment.rs | #![warn(clippy::undocumented_unsafe_blocks, clippy::unnecessary_safety_comment)]
#![allow(clippy::let_unit_value, clippy::missing_safety_doc, clippy::needless_ifs)]
mod unsafe_items_invalid_comment {
// SAFETY:
const CONST: u32 = 0;
//~^ unnecessary_safety_comment
// SAFETY:
static STATIC: u32 = 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/proc_macro.rs | src/tools/clippy/tests/ui/proc_macro.rs | //! Check that we correctly lint procedural macros.
extern crate proc_macro;
use proc_macro::TokenStream;
#[allow(dead_code)]
fn f() {
let _x = 3.14;
//~^ ERROR: approximate value of `f{32, 64}::consts::PI` found
}
#[proc_macro]
pub fn mybangmacro(t: TokenStream) -> TokenStream {
t
}
#[proc_macro_deriv... | 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.rs | src/tools/clippy/tests/ui/char_lit_as_u8.rs | #![warn(clippy::char_lit_as_u8)]
fn main() {
let _ = 'a' as u8;
//~^ char_lit_as_u8
let _ = '\n' as u8;
//~^ char_lit_as_u8
let _ = '\0' as u8;
//~^ char_lit_as_u8
let _ = '\x01' 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/modulo_arithmetic_float.rs | src/tools/clippy/tests/ui/modulo_arithmetic_float.rs | #![feature(f128)]
#![feature(f16)]
#![warn(clippy::modulo_arithmetic)]
#![allow(clippy::no_effect, clippy::unnecessary_operation, clippy::modulo_one)]
fn main() {
// Lint when both sides are const and of the opposite sign
-1.6 % 2.1;
//~^ modulo_arithmetic
1.6 % -2.1;
//~^ modulo_arithmetic
(... | 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/float_cmp_const.rs | src/tools/clippy/tests/ui/float_cmp_const.rs | //@no-rustfix: suggestions have an error margin placeholder
#![warn(clippy::float_cmp_const)]
#![allow(clippy::float_cmp)]
#![allow(unused, clippy::no_effect, clippy::unnecessary_operation)]
const ONE: f32 = 1.0;
const TWO: f32 = 2.0;
fn eq_one(x: f32) -> bool {
if x.is_nan() { false } else { x == ONE } // no err... | 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/index_refutable_slice/if_let_slice_binding.rs | src/tools/clippy/tests/ui/index_refutable_slice/if_let_slice_binding.rs | #![deny(clippy::index_refutable_slice)]
#![allow(clippy::needless_lifetimes, clippy::collapsible_if)]
enum SomeEnum<T> {
One(T),
Two(T),
Three(T),
Four(T),
}
fn lintable_examples() {
// Try with reference
let slice: Option<&[u32]> = Some(&[1, 2, 3]);
if let Some(slice) = 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/index_refutable_slice/slice_indexing_in_macro.rs | src/tools/clippy/tests/ui/index_refutable_slice/slice_indexing_in_macro.rs | #![deny(clippy::index_refutable_slice)]
macro_rules! if_let_slice_macro {
() => {
// This would normally be linted
let slice: Option<&[u32]> = Some(&[1, 2, 3]);
if let Some(slice) = slice {
println!("{}", slice[0]);
}
};
}
fn main() {
// Don't lint this
if_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/rc_clone_in_vec_init/rc.rs | src/tools/clippy/tests/ui/rc_clone_in_vec_init/rc.rs | //@no-rustfix: overlapping suggestions
#![warn(clippy::rc_clone_in_vec_init)]
#![allow(clippy::useless_vec)]
use std::rc::Rc;
use std::sync::Mutex;
fn main() {}
fn should_warn_simple_case() {
let v = vec![Rc::new("x".to_string()); 2];
//~^ rc_clone_in_vec_init
}
fn should_warn_simple_case_with_big_indentatio... | 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_clone_in_vec_init/weak.rs | src/tools/clippy/tests/ui/rc_clone_in_vec_init/weak.rs | //@no-rustfix: overlapping suggestions
#![warn(clippy::rc_clone_in_vec_init)]
#![allow(clippy::useless_vec)]
use std::rc::{Rc, Weak as UnSyncWeak};
use std::sync::{Arc, Mutex, Weak as SyncWeak};
fn main() {}
fn should_warn_simple_case() {
let v = vec![SyncWeak::<u32>::new(); 2];
//~^ rc_clone_in_vec_init
... | 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_clone_in_vec_init/arc.rs | src/tools/clippy/tests/ui/rc_clone_in_vec_init/arc.rs | //@no-rustfix: overlapping suggestions
#![warn(clippy::rc_clone_in_vec_init)]
#![allow(clippy::useless_vec)]
use std::sync::{Arc, Mutex};
fn main() {}
fn should_warn_simple_case() {
let v = vec![Arc::new("x".to_string()); 2];
//~^ rc_clone_in_vec_init
}
fn should_warn_simple_case_with_big_indentation() {
... | 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/pattern_type_mismatch/syntax.rs | src/tools/clippy/tests/ui/pattern_type_mismatch/syntax.rs | #![warn(clippy::pattern_type_mismatch)]
#![allow(
clippy::match_ref_pats,
clippy::never_loop,
clippy::redundant_pattern_matching,
clippy::single_match
)]
//@aux-build:external.rs
use external::macro_with_match;
fn main() {}
fn syntax_match() {
let ref_value = &Some(&Some(42));
// not ok
... | 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/pattern_type_mismatch/pattern_tuples.rs | src/tools/clippy/tests/ui/pattern_type_mismatch/pattern_tuples.rs | #![warn(clippy::pattern_type_mismatch)]
fn main() {}
fn tuple_types() {
struct TupleStruct<'a>(&'a Option<i32>);
let ref_value = &TupleStruct(&Some(42));
// not ok
let TupleStruct(_) = ref_value;
//~^ pattern_type_mismatch
if let &TupleStruct(Some(_)) = ref_value {}
//~^ pattern_type_mis... | 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/pattern_type_mismatch/pattern_alternatives.rs | src/tools/clippy/tests/ui/pattern_type_mismatch/pattern_alternatives.rs | #![warn(clippy::pattern_type_mismatch)]
fn main() {}
fn alternatives() {
enum Value<'a> {
Unused,
A(&'a Option<i32>),
B,
}
let ref_value = &Value::A(&Some(23));
// not ok
if let Value::B | Value::A(_) = ref_value {}
//~^ pattern_type_mismatch
if let &Value::B | &V... | 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/pattern_type_mismatch/mutability.rs | src/tools/clippy/tests/ui/pattern_type_mismatch/mutability.rs | #![warn(clippy::pattern_type_mismatch)]
#![allow(clippy::single_match)]
fn main() {}
fn should_lint() {
let value = &Some(23);
match value {
Some(_) => (),
//~^ pattern_type_mismatch
_ => (),
}
let value = &mut Some(23);
match value {
Some(_) => (),
//~^ pa... | 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/pattern_type_mismatch/pattern_structs.rs | src/tools/clippy/tests/ui/pattern_type_mismatch/pattern_structs.rs | #![warn(clippy::pattern_type_mismatch)]
fn main() {}
fn struct_types() {
struct Struct<'a> {
ref_inner: &'a Option<i32>,
}
let ref_value = &Struct { ref_inner: &Some(42) };
// not ok
let Struct { .. } = ref_value;
//~^ pattern_type_mismatch
if let &Struct { ref_inner: 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/pattern_type_mismatch/auxiliary/external.rs | src/tools/clippy/tests/ui/pattern_type_mismatch/auxiliary/external.rs | //! **FAKE** external macro crate.
#[macro_export]
macro_rules! macro_with_match {
( $p:pat ) => {
let something = ();
match &something {
$p => true,
_ => 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/dbg_macro/dbg_macro.rs | src/tools/clippy/tests/ui/dbg_macro/dbg_macro.rs | #![allow(
clippy::no_effect,
clippy::uninlined_format_args,
clippy::unit_arg,
clippy::unnecessary_operation
)]
#![warn(clippy::dbg_macro)]
fn foo(n: u32) -> u32 {
if let Some(n) = dbg!(n.checked_sub(4)) { n } else { n }
//~^ dbg_macro
}
fn bar(_: ()) {}
fn factorial(n: u32) -> u32 {
if dbg... | 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/dbg_macro/dbg_macro_unfixable.rs | src/tools/clippy/tests/ui/dbg_macro/dbg_macro_unfixable.rs | //@no-rustfix: overlapping suggestions
//@error-in-other-file:
#![warn(clippy::dbg_macro)]
#[path = "auxiliary/submodule.rs"]
mod submodule;
fn main() {
dbg!(dbg!(dbg!(42)));
//~^ dbg_macro
//~| dbg_macro
//~| dbg_macro
dbg!(1, 2, dbg!(3, 4));
//~^ dbg_macro
//~| dbg_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/dbg_macro/auxiliary/submodule.rs | src/tools/clippy/tests/ui/dbg_macro/auxiliary/submodule.rs | fn f() {
dbg!();
}
| 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_owned/without_suggestion.rs | src/tools/clippy/tests/ui/cmp_owned/without_suggestion.rs | #![allow(clippy::unnecessary_operation)]
#![allow(clippy::implicit_clone)]
fn main() {
let x = &Baz;
let y = &Baz;
y.to_owned() == *x;
//~^ cmp_owned
let x = &&Baz;
let y = &Baz;
y.to_owned() == **x;
//~^ cmp_owned
let x = 0u32;
let y = U32Wrapper(x);
let _ = U32Wrapper::f... | 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_owned/asymmetric_partial_eq.rs | src/tools/clippy/tests/ui/cmp_owned/asymmetric_partial_eq.rs | #![allow(
unused,
clippy::needless_ifs,
clippy::redundant_clone,
clippy::derive_partial_eq_without_eq
)] // See #5700
// Define the types in each module to avoid trait impls leaking between modules.
macro_rules! impl_types {
() => {
#[derive(PartialEq)]
pub struct Owned;
pu... | 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_owned/with_suggestion.rs | src/tools/clippy/tests/ui/cmp_owned/with_suggestion.rs | #[warn(clippy::cmp_owned)]
#[allow(clippy::unnecessary_operation, clippy::no_effect, unused_must_use, clippy::eq_op)]
fn main() {
fn with_to_string(x: &str) {
x != "foo".to_string();
//~^ cmp_owned
"foo".to_string() != x;
//~^ cmp_owned
}
let x = "oh";
with_to_string(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/cmp_owned/comparison_flip.rs | src/tools/clippy/tests/ui/cmp_owned/comparison_flip.rs | use std::fmt::{self, Display};
fn main() {
let a = Foo;
if a.to_string() != "bar" {
//~^ cmp_owned
println!("foo");
}
if "bar" != a.to_string() {
//~^ cmp_owned
println!("foo");
}
}
struct Foo;
impl Display for Foo {
fn fmt(&self, f: &mut fmt::Formatter) -> f... | 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/size_of_in_element_count/functions.rs | src/tools/clippy/tests/ui/size_of_in_element_count/functions.rs | #![warn(clippy::size_of_in_element_count)]
#![allow(clippy::ptr_offset_with_cast)]
use std::mem::{size_of, size_of_val};
use std::ptr::{
copy, copy_nonoverlapping, slice_from_raw_parts, slice_from_raw_parts_mut, swap_nonoverlapping, write_bytes,
};
use std::slice::{from_raw_parts, from_raw_parts_mut};
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/size_of_in_element_count/expressions.rs | src/tools/clippy/tests/ui/size_of_in_element_count/expressions.rs | #![warn(clippy::size_of_in_element_count)]
#![allow(clippy::ptr_offset_with_cast)]
use std::mem::{size_of, size_of_val};
use std::ptr::{copy, copy_nonoverlapping, write_bytes};
fn main() {
const SIZE: usize = 128;
const HALF_SIZE: usize = SIZE / 2;
const DOUBLE_SIZE: usize = SIZE * 2;
let mut x = [2u1... | 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_std_lazy_static/non_std_lazy_static_other_once_cell.rs | src/tools/clippy/tests/ui/non_std_lazy_static/non_std_lazy_static_other_once_cell.rs | //@ check-pass
//@aux-build:once_cell.rs
#![warn(clippy::non_std_lazy_statics)]
// Should not error, since we used a type besides `sync::Lazy`
fn use_once_cell_race(x: once_cell::race::OnceBox<String>) {
let _foo = x.get();
}
use once_cell::sync::Lazy;
static LAZY_BAZ: Lazy<String> = Lazy::new(|| "baz".to_upper... | 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_std_lazy_static/non_std_lazy_static_unfixable.rs | src/tools/clippy/tests/ui/non_std_lazy_static/non_std_lazy_static_unfixable.rs | //@aux-build:once_cell.rs
//@aux-build:lazy_static.rs
//@no-rustfix
#![warn(clippy::non_std_lazy_statics)]
#![allow(static_mut_refs)]
mod once_cell_lazy {
use once_cell::sync::Lazy;
static LAZY_FOO: Lazy<String> = Lazy::new(|| "foo".to_uppercase());
//~^ ERROR: this type has been superseded by `LazyLock`... | 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_std_lazy_static/non_std_lazy_static_fixable.rs | src/tools/clippy/tests/ui/non_std_lazy_static/non_std_lazy_static_fixable.rs | //@aux-build:once_cell.rs
//@aux-build:lazy_static.rs
#![warn(clippy::non_std_lazy_statics)]
#![allow(static_mut_refs)]
use once_cell::sync::Lazy;
fn main() {}
static LAZY_FOO: Lazy<String> = Lazy::new(|| "foo".to_uppercase());
//~^ ERROR: this type has been superseded by `LazyLock` in the standard library
static 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/non_std_lazy_static/non_std_lazy_static_no_std.rs | src/tools/clippy/tests/ui/non_std_lazy_static/non_std_lazy_static_no_std.rs | //@ check-pass
//@aux-build:once_cell.rs
//@aux-build:lazy_static.rs
#![warn(clippy::non_std_lazy_statics)]
#![no_std]
use lazy_static::lazy_static;
use once_cell::sync::Lazy;
fn main() {}
static LAZY_FOO: Lazy<usize> = Lazy::new(|| 42);
static LAZY_BAR: Lazy<i32> = Lazy::new(|| {
let x: i32 = 0;
x.saturati... | 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_std_lazy_static/auxiliary/once_cell.rs | src/tools/clippy/tests/ui/non_std_lazy_static/auxiliary/once_cell.rs | //! **FAKE** once_cell crate.
pub mod sync {
use std::marker::PhantomData;
pub struct Lazy<T, F = fn() -> T> {
cell: PhantomData<T>,
init: F,
}
unsafe impl<T, F: Send> Sync for Lazy<T, F> {}
impl<T, F> Lazy<T, F> {
pub const fn new(f: F) -> Lazy<T, F> {
Lazy {
... | 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_std_lazy_static/auxiliary/lazy_static.rs | src/tools/clippy/tests/ui/non_std_lazy_static/auxiliary/lazy_static.rs | //! **FAKE** lazy_static crate.
#[macro_export]
macro_rules! lazy_static {
(static ref $N:ident : $T:ty = $e:expr; $($t:tt)*) => {
static $N : &::core::marker::PhantomData<$T> = &::core::marker::PhantomData;
$crate::lazy_static! { $($t)* }
};
() => ()
}
#[macro_export]
macro_rules! extern... | 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/crate_level_checks/no_std_swap.rs | src/tools/clippy/tests/ui/crate_level_checks/no_std_swap.rs | #![no_std]
#![crate_type = "lib"]
use core::panic::PanicInfo;
pub fn main() {
let mut a = 42;
let mut b = 1337;
a = b;
//~^ almost_swapped
b = 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/crate_level_checks/std_main_recursion.rs | src/tools/clippy/tests/ui/crate_level_checks/std_main_recursion.rs | #[warn(clippy::main_recursion)]
#[allow(unconditional_recursion)]
fn main() {
println!("Hello, World!");
main();
//~^ main_recursion
}
| 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/crate_level_checks/entrypoint_recursion.rs | src/tools/clippy/tests/ui/crate_level_checks/entrypoint_recursion.rs | //@check-pass
//@ignore-target: apple
#![feature(rustc_attrs)]
#[warn(clippy::main_recursion)]
#[allow(unconditional_recursion)]
#[rustc_main]
fn a() {
println!("Hello, World!");
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/author/struct.rs | src/tools/clippy/tests/ui/author/struct.rs | //@ check-pass
#![allow(
clippy::unnecessary_operation,
clippy::single_match,
clippy::no_effect,
clippy::bool_to_int_with_if
)]
fn main() {
struct Test {
field: u32,
}
#[clippy::author]
Test {
field: if true { 1 } else { 0 },
};
let test = Test { field: 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/author/if.rs | src/tools/clippy/tests/ui/author/if.rs | //@ check-pass
#![allow(clippy::all)]
fn main() {
#[clippy::author]
let _ = if true {
1 == 1;
} else {
2 == 2;
};
let a = true;
#[clippy::author]
if let true = a {
} 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/author/issue_3849.rs | src/tools/clippy/tests/ui/author/issue_3849.rs | //@ check-pass
#![allow(dead_code)]
#![allow(clippy::zero_ptr)]
#![allow(clippy::transmute_ptr_to_ref)]
#![allow(clippy::transmuting_null, clippy::missing_transmute_annotations)]
pub const ZPTR: *const usize = 0 as *const _;
fn main() {
unsafe {
#[clippy::author]
let _: &i32 = std::mem::transmute... | 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/author/repeat.rs | src/tools/clippy/tests/ui/author/repeat.rs | //@ check-pass
#[allow(clippy::no_effect)]
fn main() {
#[clippy::author]
[1_u8; 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/author/loop.rs | src/tools/clippy/tests/ui/author/loop.rs | //@ check-pass
#![feature(stmt_expr_attributes)]
#![allow(
clippy::never_loop,
clippy::while_immutable_condition,
clippy::redundant_pattern_matching
)]
fn main() {
#[clippy::author]
for y in 0..10 {
let z = y;
}
#[clippy::author]
for _ in 0..10 {
break;
}
#[cl... | 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/author/call.rs | src/tools/clippy/tests/ui/author/call.rs | //@ check-pass
fn main() {
#[clippy::author]
let _ = ::std::cmp::min(3, 4);
}
| 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/author/matches.rs | src/tools/clippy/tests/ui/author/matches.rs | //@ check-pass
#![allow(clippy::let_and_return)]
fn main() {
#[clippy::author]
let a = match 42 {
16 => 5,
17 => {
let x = 3;
x
},
_ => 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/author/macro_in_loop.rs | src/tools/clippy/tests/ui/author/macro_in_loop.rs | //@ check-pass
#![feature(stmt_expr_attributes)]
#![allow(clippy::uninlined_format_args)]
fn main() {
#[clippy::author]
for i in 0..1 {
println!("{}", 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/author/blocks.rs | src/tools/clippy/tests/ui/author/blocks.rs | //@ check-pass
//@edition:2018
#![allow(redundant_semicolons, clippy::no_effect)]
#![feature(stmt_expr_attributes)]
#[rustfmt::skip]
fn main() {
#[clippy::author]
{
let x = 42i32;
let _t = 1f32;
-x;
};
#[clippy::author]
{
let expr = String::new();
drop(expr... | 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/author/macro_in_closure.rs | src/tools/clippy/tests/ui/author/macro_in_closure.rs | //@ check-pass
#![allow(clippy::uninlined_format_args)]
fn main() {
#[clippy::author]
let print_text = |x| println!("{}", x);
print_text("hello");
}
| 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_line_after/doc_comments.rs | src/tools/clippy/tests/ui/empty_line_after/doc_comments.rs | #![warn(clippy::empty_line_after_outer_attr, clippy::empty_line_after_doc_comments)]
//~vvv empty_line_after_doc_comments
/// Meant to be an
/// inner doc comment
/// for the crate
fn first_in_crate() {}
mod m {
//~vvv empty_line_after_doc_comments
/// Meant to be an
/// inner doc comment
/// for the... | 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_line_after/outer_attribute.rs | src/tools/clippy/tests/ui/empty_line_after/outer_attribute.rs | //@aux-build:../auxiliary/proc_macro_attr.rs
#![warn(clippy::empty_line_after_outer_attr, clippy::empty_line_after_doc_comments)]
//~v empty_line_after_outer_attr
#[crate_type = "lib"]
fn first_in_crate() {}
#[macro_use]
extern crate proc_macro_attr;
//~v empty_line_after_outer_attr
#[inline]
/// some comment
fn w... | 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_unwrap/simple_conditionals.rs | src/tools/clippy/tests/ui/checked_unwrap/simple_conditionals.rs | //@no-rustfix: has placeholders
#![warn(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
#![expect(
clippy::if_same_then_else,
clippy::branches_sharing_code,
clippy::unnecessary_literal_unwrap,
clippy::self_assignment
)]
macro_rules! m {
($a:expr) => {
if $a.is_some() {
$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/checked_unwrap/if_let_chains.rs | src/tools/clippy/tests/ui/checked_unwrap/if_let_chains.rs | //@require-annotations-for-level: ERROR
#![warn(clippy::unnecessary_unwrap)]
#[clippy::msrv = "1.85"]
fn if_let_chains_unsupported(a: Option<u32>, b: Option<u32>) {
if a.is_none() || b.is_none() {
println!("a or b is not set");
} else {
println!("the value of a is {}", a.unwrap());
//~^... | 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_unwrap/complex_conditionals.rs | src/tools/clippy/tests/ui/checked_unwrap/complex_conditionals.rs | #![warn(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
#![expect(clippy::branches_sharing_code, clippy::unnecessary_literal_unwrap)]
fn test_complex_conditions() {
let x: Result<(), ()> = Ok(());
let y: Result<(), ()> = Ok(());
if x.is_ok() && y.is_err() {
x.unwrap();
//~^ unnecessa... | 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_unwrap/complex_conditionals_nested.rs | src/tools/clippy/tests/ui/checked_unwrap/complex_conditionals_nested.rs | //@no-rustfix: has placeholders
#![warn(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
#![expect(clippy::branches_sharing_code, clippy::unnecessary_literal_unwrap)]
fn test_nested() {
fn nested() {
let x = Some(());
if x.is_some() {
x.unwrap();
//~^ unnecessary_unwra... | 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_const_for_fn/cant_be_const.rs | src/tools/clippy/tests/ui/missing_const_for_fn/cant_be_const.rs | //@ check-pass
//! False-positive tests to ensure we don't suggest `const` for things where it would cause a
//! compilation error.
//! The .stderr output of this test should be empty. Otherwise it's a bug somewhere.
//@aux-build:helper.rs
//@aux-build:../auxiliary/proc_macros.rs
#![warn(clippy::missing_const_for_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/missing_const_for_fn/const_trait.rs | src/tools/clippy/tests/ui/missing_const_for_fn/const_trait.rs | #![feature(const_trait_impl)]
#![warn(clippy::missing_const_for_fn)]
// Reduced test case from https://github.com/rust-lang/rust-clippy/issues/14658
const trait ConstTrait {
fn method(self);
}
impl ConstTrait for u32 {
fn method(self) {}
}
impl const ConstTrait for u64 {
fn method(self) {}
}
fn cannot_... | 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_const_for_fn/could_be_const.rs | src/tools/clippy/tests/ui/missing_const_for_fn/could_be_const.rs | #![warn(clippy::missing_const_for_fn)]
#![allow(incomplete_features, clippy::let_and_return, clippy::missing_transmute_annotations)]
#![feature(const_trait_impl)]
use std::mem::transmute;
struct Game {
guess: i32,
}
impl Game {
// Could be const
pub fn new() -> Self {
//~^ missing_const_for_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/missing_const_for_fn/auxiliary/helper.rs | src/tools/clippy/tests/ui/missing_const_for_fn/auxiliary/helper.rs | // This file provides a const function that is unstably const forever.
#![feature(staged_api)]
#![stable(feature = "clippytest", since = "1.0.0")]
#[stable(feature = "clippytest", since = "1.0.0")]
#[rustc_const_unstable(feature = "foo", issue = "none")]
pub const fn unstably_const_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/should_impl_trait/method_list_1.rs | src/tools/clippy/tests/ui/should_impl_trait/method_list_1.rs | //@revisions: edition2015 edition2021
//@[edition2015] edition:2015
//@[edition2021] edition:2021
#![allow(
clippy::missing_errors_doc,
clippy::needless_pass_by_value,
clippy::must_use_candidate,
clippy::unused_self,
clippy::needless_lifetimes,
clippy::missing_safety_doc,
clippy::wrong_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/should_impl_trait/corner_cases.rs | src/tools/clippy/tests/ui/should_impl_trait/corner_cases.rs | //@ check-pass
#![allow(
clippy::missing_errors_doc,
clippy::needless_pass_by_value,
clippy::must_use_candidate,
clippy::unused_self,
clippy::needless_lifetimes,
clippy::missing_safety_doc,
clippy::wrong_self_convention,
clippy::missing_panics_doc,
clippy::return_self_not_must_use,
... | 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_impl_trait/method_list_2.rs | src/tools/clippy/tests/ui/should_impl_trait/method_list_2.rs | //@revisions: edition2015 edition2021
//@[edition2015] edition:2015
//@[edition2021] edition:2021
#![allow(
clippy::missing_errors_doc,
clippy::needless_pass_by_value,
clippy::must_use_candidate,
clippy::unused_self,
clippy::needless_lifetimes,
clippy::missing_safety_doc,
clippy::wrong_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/out_of_bounds_indexing/issue-3102.rs | src/tools/clippy/tests/ui/out_of_bounds_indexing/issue-3102.rs | #![warn(clippy::out_of_bounds_indexing)]
#![allow(clippy::no_effect)]
fn main() {
let x = [1, 2, 3, 4];
// issue 3102
let num = 1;
&x[num..10];
//~^ out_of_bounds_indexing
&x[10..num];
//~^ out_of_bounds_indexing
}
| 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/out_of_bounds_indexing/simple.rs | src/tools/clippy/tests/ui/out_of_bounds_indexing/simple.rs | #![warn(clippy::out_of_bounds_indexing)]
#![allow(clippy::no_effect, clippy::unnecessary_operation)]
fn main() {
let x = [1, 2, 3, 4];
&x[..=4];
//~^ out_of_bounds_indexing
&x[1..5];
//~^ out_of_bounds_indexing
&x[5..];
//~^ out_of_bounds_indexing
&x[..5];
//~^ out_of_bounds_ind... | 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/auxiliary/proc_macro_unsafe.rs | src/tools/clippy/tests/ui/auxiliary/proc_macro_unsafe.rs | extern crate proc_macro;
use proc_macro::{Delimiter, Group, Ident, TokenStream, TokenTree};
#[proc_macro]
pub fn unsafe_block(input: TokenStream) -> TokenStream {
let span = input.into_iter().next().unwrap().span();
TokenStream::from_iter([TokenTree::Ident(Ident::new("unsafe", span)), {
let mut group ... | 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/auxiliary/macro_rules.rs | src/tools/clippy/tests/ui/auxiliary/macro_rules.rs | #![allow(dead_code)]
//! Used to test that certain lints don't trigger in imported external macros
#[macro_export]
macro_rules! try_err {
() => {
pub fn try_err_fn() -> Result<i32, i32> {
let err: i32 = 1;
// To avoid warnings during rustfix
if true { Err(err)? } 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/auxiliary/proc_macro_attr.rs | src/tools/clippy/tests/ui/auxiliary/proc_macro_attr.rs | #![feature(proc_macro_hygiene, proc_macro_quote, box_patterns)]
#![allow(clippy::useless_conversion, clippy::uninlined_format_args)]
extern crate proc_macro;
extern crate quote;
extern crate syn;
use proc_macro::TokenStream;
use quote::{quote, quote_spanned};
use syn::spanned::Spanned;
use syn::token::Star;
use syn::... | 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/auxiliary/extern_fake_libc.rs | src/tools/clippy/tests/ui/auxiliary/extern_fake_libc.rs | #![allow(nonstandard_style)]
#![allow(clippy::missing_safety_doc, unused)]
type pid_t = i32;
pub unsafe fn getpid() -> pid_t {
pid_t::from(0)
}
pub fn getpid_SAFE_TRUTH() -> pid_t {
unsafe { getpid() }
}
| 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/auxiliary/option_helpers.rs | src/tools/clippy/tests/ui/auxiliary/option_helpers.rs | #![allow(dead_code, unused_variables, clippy::return_self_not_must_use)]
/// Utility macro to test linting behavior in `option_methods()`
/// The lints included in `option_methods()` should not lint if the call to map is partially
/// within a macro
#[macro_export]
macro_rules! opt_map {
($opt:expr, $map:expr) => ... | 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/auxiliary/test_macro.rs | src/tools/clippy/tests/ui/auxiliary/test_macro.rs | pub trait A {}
macro_rules! __implicit_hasher_test_macro {
(impl< $($impl_arg:tt),* > for $kind:ty where $($bounds:tt)*) => {
__implicit_hasher_test_macro!( ($($impl_arg),*) ($kind) ($($bounds)*) );
};
(($($impl_arg:tt)*) ($($kind_arg:tt)*) ($($bounds:tt)*)) => {
impl< $($impl_arg)* > test... | 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/auxiliary/external_item.rs | src/tools/clippy/tests/ui/auxiliary/external_item.rs | pub struct _ExternalStruct {}
impl _ExternalStruct {
pub fn _foo(self) {}
}
pub fn _external_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/auxiliary/proc_macros.rs | src/tools/clippy/tests/ui/auxiliary/proc_macros.rs | #![feature(proc_macro_span)]
#![allow(clippy::needless_ifs, dead_code)]
extern crate proc_macro;
use core::mem;
use proc_macro::Delimiter::{self, Brace, Parenthesis};
use proc_macro::Spacing::{self, Alone, Joint};
use proc_macro::token_stream::IntoIter;
use proc_macro::{Group, Ident, Literal, Punct, Span, TokenStream... | 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/auxiliary/wildcard_imports_helper.rs | src/tools/clippy/tests/ui/auxiliary/wildcard_imports_helper.rs | pub use crate::extern_exports::*;
pub fn extern_foo() {}
pub fn extern_bar() {}
pub struct ExternA;
pub mod inner {
pub mod inner_for_self_import {
pub fn inner_extern_foo() {}
pub fn inner_extern_bar() {}
}
}
mod extern_exports {
pub fn extern_exported() {}
pub struct ExternExported... | 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/auxiliary/use_self_macro.rs | src/tools/clippy/tests/ui/auxiliary/use_self_macro.rs | macro_rules! use_self {
(
impl $ty:ident {
fn func(&$this:ident) {
[fields($($field:ident)*)]
}
}
) => (
impl $ty {
fn func(&$this) {
let $ty { $($field),* } = $this;
}
}
)
}
| 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.