mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 07:04:18 +00:00
Adapt ui-tests to the tool_lints
This commit is contained in:
parent
bb49b31254
commit
1b6f6051a8
176 changed files with 597 additions and 486 deletions
|
@ -1,8 +1,8 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
|
||||
#![warn(absurd_extreme_comparisons)]
|
||||
#![allow(unused, eq_op, no_effect, unnecessary_operation, needless_pass_by_value)]
|
||||
#![warn(clippy::absurd_extreme_comparisons)]
|
||||
#![allow(unused, clippy::eq_op, clippy::no_effect, clippy::unnecessary_operation, clippy::needless_pass_by_value)]
|
||||
|
||||
fn main() {
|
||||
const Z: u32 = 0;
|
||||
|
@ -27,7 +27,7 @@ fn main() {
|
|||
b >= true;
|
||||
false > b;
|
||||
u > 0; // ok
|
||||
// this is handled by unit_cmp
|
||||
// this is handled by clippy::unit_cmp
|
||||
() < {};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
|
||||
#[warn(approx_constant)]
|
||||
#[allow(unused, shadow_unrelated, similar_names, unreadable_literal)]
|
||||
#[warn(clippy::approx_constant)]
|
||||
#[allow(unused, clippy::shadow_unrelated, clippy::similar_names, clippy::unreadable_literal)]
|
||||
fn main() {
|
||||
let my_e = 2.7182;
|
||||
let almost_e = 2.718;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
|
||||
#![warn(integer_arithmetic, float_arithmetic)]
|
||||
#![allow(unused, shadow_reuse, shadow_unrelated, no_effect, unnecessary_operation)]
|
||||
#![warn(clippy::integer_arithmetic, clippy::float_arithmetic)]
|
||||
#![allow(unused, clippy::shadow_reuse, clippy::shadow_unrelated, clippy::no_effect, clippy::unnecessary_operation)]
|
||||
fn main() {
|
||||
let i = 1i32;
|
||||
1 + i;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
#[allow(dead_code, unused_assignments)]
|
||||
#[warn(assign_op_pattern)]
|
||||
#[warn(clippy::assign_op_pattern)]
|
||||
fn main() {
|
||||
let mut a = 5;
|
||||
a = a + 1;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
#[allow(unused_assignments)]
|
||||
#[warn(misrefactored_assign_op, assign_op_pattern)]
|
||||
#[warn(clippy::misrefactored_assign_op, clippy::assign_op_pattern)]
|
||||
fn main() {
|
||||
let mut a = 5;
|
||||
a += a + 1;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
|
||||
#![warn(inline_always, deprecated_semver)]
|
||||
#![warn(clippy::inline_always, clippy::deprecated_semver)]
|
||||
|
||||
#[inline(always)]
|
||||
fn test_attr_lint() {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
|
||||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
const THREE_BITS : i64 = 7;
|
||||
const EVEN_MORE_REDIRECTION : i64 = THREE_BITS;
|
||||
|
||||
#[warn(bad_bit_mask)]
|
||||
#[allow(ineffective_bit_mask, identity_op, no_effect, unnecessary_operation)]
|
||||
#[warn(clippy::bad_bit_mask)]
|
||||
#[allow(clippy::ineffective_bit_mask, clippy::identity_op, clippy::no_effect, clippy::unnecessary_operation)]
|
||||
fn main() {
|
||||
let x = 5;
|
||||
|
||||
|
@ -44,8 +44,8 @@ fn main() {
|
|||
ineffective();
|
||||
}
|
||||
|
||||
#[warn(ineffective_bit_mask)]
|
||||
#[allow(bad_bit_mask, no_effect, unnecessary_operation)]
|
||||
#[warn(clippy::ineffective_bit_mask)]
|
||||
#[allow(clippy::bad_bit_mask, clippy::no_effect, clippy::unnecessary_operation)]
|
||||
fn ineffective() {
|
||||
let x = 5;
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
|
||||
#![allow(dead_code, similar_names, single_match, toplevel_ref_arg, unused_mut, unused_variables)]
|
||||
#![warn(blacklisted_name)]
|
||||
#![allow(dead_code, clippy::similar_names, clippy::single_match, clippy::toplevel_ref_arg, unused_mut, unused_variables)]
|
||||
#![warn(clippy::blacklisted_name)]
|
||||
|
||||
fn test(foo: ()) {}
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
|
||||
#![warn(block_in_if_condition_expr)]
|
||||
#![warn(block_in_if_condition_stmt)]
|
||||
#![allow(unused, let_and_return)]
|
||||
#![warn(nonminimal_bool)]
|
||||
#![warn(clippy::block_in_if_condition_expr)]
|
||||
#![warn(clippy::block_in_if_condition_stmt)]
|
||||
#![allow(unused, clippy::let_and_return)]
|
||||
#![warn(clippy::nonminimal_bool)]
|
||||
|
||||
|
||||
macro_rules! blocky {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
|
||||
#[warn(bool_comparison)]
|
||||
#[warn(clippy::bool_comparison)]
|
||||
fn main() {
|
||||
let x = true;
|
||||
if x == true { "yes" } else { "no" };
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
#![warn(clippy::nonminimal_bool, clippy::logic_bug)]
|
||||
|
||||
#![warn(nonminimal_bool, logic_bug)]
|
||||
|
||||
#[allow(unused, many_single_char_names)]
|
||||
#[allow(unused, clippy::many_single_char_names)]
|
||||
fn main() {
|
||||
let a: bool = unimplemented!();
|
||||
let b: bool = unimplemented!();
|
||||
|
@ -23,7 +23,7 @@ fn main() {
|
|||
let _ = !(!a && b);
|
||||
}
|
||||
|
||||
#[allow(unused, many_single_char_names)]
|
||||
#[allow(unused, clippy::many_single_char_names)]
|
||||
fn equality_stuff() {
|
||||
let a: i32 = unimplemented!();
|
||||
let b: i32 = unimplemented!();
|
||||
|
@ -39,7 +39,7 @@ fn equality_stuff() {
|
|||
let _ = a != b || !(a != b || c == d);
|
||||
}
|
||||
|
||||
#[allow(unused, many_single_char_names)]
|
||||
#[allow(unused, clippy::many_single_char_names)]
|
||||
fn methods_with_negation() {
|
||||
let a: Option<i32> = unimplemented!();
|
||||
let b: Result<i32, i32> = unimplemented!();
|
||||
|
@ -59,7 +59,7 @@ fn methods_with_negation() {
|
|||
}
|
||||
|
||||
// Simplified versions of https://github.com/rust-lang-nursery/rust-clippy/issues/2638
|
||||
// nonminimal_bool should only check the built-in Result and Some type, not
|
||||
// clippy::nonminimal_bool should only check the built-in Result and Some type, not
|
||||
// any other types like the following.
|
||||
enum CustomResultOk<E> { Ok, Err(E) }
|
||||
enum CustomResultErr<E> { Ok, Err(E) }
|
||||
|
@ -115,7 +115,7 @@ fn warn_for_built_in_methods_with_negation() {
|
|||
if !res.is_none() { }
|
||||
}
|
||||
|
||||
#[allow(neg_cmp_op_on_partial_ord)]
|
||||
#[allow(clippy::neg_cmp_op_on_partial_ord)]
|
||||
fn dont_warn_for_negated_partial_ord_comparison() {
|
||||
let a: f64 = unimplemented!();
|
||||
let b: f64 = unimplemented!();
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
|
||||
#![deny(borrowed_box)]
|
||||
#![allow(blacklisted_name)]
|
||||
#![deny(clippy::borrowed_box)]
|
||||
#![allow(clippy::blacklisted_name)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
|
||||
#![warn(clippy)]
|
||||
#![allow(boxed_local, needless_pass_by_value)]
|
||||
#![allow(blacklisted_name)]
|
||||
#![warn(clippy::all)]
|
||||
#![allow(clippy::boxed_local, clippy::needless_pass_by_value)]
|
||||
#![allow(clippy::blacklisted_name)]
|
||||
|
||||
macro_rules! boxit {
|
||||
($init:expr, $x:ty) => {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
#![warn(builtin_type_shadow)]
|
||||
#![warn(clippy::builtin_type_shadow)]
|
||||
|
||||
fn foo<u32>(a: u32) -> u32 {
|
||||
42
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
|
||||
#[deny(naive_bytecount)]
|
||||
#[deny(clippy::naive_bytecount)]
|
||||
fn main() {
|
||||
let x = vec![0_u8; 16];
|
||||
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
|
||||
#[warn(cast_precision_loss, cast_possible_truncation, cast_sign_loss, cast_possible_wrap, cast_lossless)]
|
||||
#[allow(no_effect, unnecessary_operation)]
|
||||
#[warn(clippy::cast_precision_loss, clippy::cast_possible_truncation, clippy::cast_sign_loss, clippy::cast_possible_wrap, clippy::cast_lossless)]
|
||||
#[allow(clippy::no_effect, clippy::unnecessary_operation)]
|
||||
fn main() {
|
||||
// Test cast_precision_loss
|
||||
// Test clippy::cast_precision_loss
|
||||
1i32 as f32;
|
||||
1i64 as f32;
|
||||
1i64 as f64;
|
||||
1u32 as f32;
|
||||
1u64 as f32;
|
||||
1u64 as f64;
|
||||
// Test cast_possible_truncation
|
||||
// Test clippy::cast_possible_truncation
|
||||
1f32 as i32;
|
||||
1f32 as u32;
|
||||
1f64 as f32;
|
||||
|
@ -19,17 +19,17 @@ fn main() {
|
|||
1i32 as u8;
|
||||
1f64 as isize;
|
||||
1f64 as usize;
|
||||
// Test cast_possible_wrap
|
||||
// Test clippy::cast_possible_wrap
|
||||
1u8 as i8;
|
||||
1u16 as i16;
|
||||
1u32 as i32;
|
||||
1u64 as i64;
|
||||
1usize as isize;
|
||||
// Test cast_lossless with casts from floating-point types
|
||||
// Test clippy::cast_lossless with casts from floating-point types
|
||||
1.0f32 as f64;
|
||||
// Test cast_lossless with an expression wrapped in parens
|
||||
// Test clippy::cast_lossless with an expression wrapped in parens
|
||||
(1u8 + 1u8) as u16;
|
||||
// Test cast_sign_loss
|
||||
// Test clippy::cast_sign_loss
|
||||
1i32 as u32;
|
||||
1isize as usize;
|
||||
// Extra checks for *size
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
//! Test casts for alignment issues
|
||||
|
||||
#![feature(libc)]
|
||||
|
||||
extern crate libc;
|
||||
|
||||
#[warn(cast_ptr_alignment)]
|
||||
#[allow(no_effect, unnecessary_operation, cast_lossless)]
|
||||
#[warn(clippy::cast_ptr_alignment)]
|
||||
#[allow(clippy::no_effect, clippy::unnecessary_operation, clippy::cast_lossless)]
|
||||
fn main() {
|
||||
/* These should be warned against */
|
||||
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
#[warn(cast_lossless)]
|
||||
#[allow(no_effect, unnecessary_operation)]
|
||||
#![feature(tool_lints)]
|
||||
|
||||
#[warn(clippy::cast_lossless)]
|
||||
#[allow(clippy::no_effect, clippy::unnecessary_operation)]
|
||||
fn main() {
|
||||
// Test cast_lossless with casts to floating-point types
|
||||
// Test clippy::cast_lossless with casts to floating-point types
|
||||
1i8 as f32;
|
||||
1i8 as f64;
|
||||
1u8 as f32;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
#[warn(cast_lossless)]
|
||||
#[allow(no_effect, unnecessary_operation)]
|
||||
#![feature(tool_lints)]
|
||||
#[warn(clippy::cast_lossless)]
|
||||
#[allow(clippy::no_effect, clippy::unnecessary_operation)]
|
||||
fn main() {
|
||||
// Test cast_lossless with casts to integer types
|
||||
// Test clippy::cast_lossless with casts to integer types
|
||||
1i8 as i16;
|
||||
1i8 as i32;
|
||||
1i8 as i64;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#[warn(cast_precision_loss, cast_possible_truncation, cast_sign_loss, cast_possible_wrap, cast_lossless)]
|
||||
#[allow(no_effect, unnecessary_operation)]
|
||||
#![feature(tool_lints)]
|
||||
|
||||
#[warn(clippy::cast_precision_loss, clippy::cast_possible_truncation, clippy::cast_sign_loss, clippy::cast_possible_wrap, clippy::cast_lossless)]
|
||||
#[allow(clippy::no_effect, clippy::unnecessary_operation)]
|
||||
fn main() {
|
||||
// Casting from *size
|
||||
1isize as i8;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
|
||||
#![warn(char_lit_as_u8)]
|
||||
#![warn(clippy::char_lit_as_u8)]
|
||||
#![allow(unused_variables)]
|
||||
fn main() {
|
||||
let c = 'a' as u8;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#![deny(panicking_unwrap, unnecessary_unwrap)]
|
||||
#![allow(if_same_then_else)]
|
||||
#![feature(tool_lints)]
|
||||
|
||||
#![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
|
||||
#![allow(clippy::if_same_then_else)]
|
||||
|
||||
fn main() {
|
||||
let x = Some(());
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
pub fn dec_read_dec(i: &mut i32) -> i32 {
|
||||
*i -= 1;
|
||||
let ret = *i;
|
||||
|
@ -5,7 +7,7 @@ pub fn dec_read_dec(i: &mut i32) -> i32 {
|
|||
ret
|
||||
}
|
||||
|
||||
#[allow(trivially_copy_pass_by_ref)]
|
||||
#[allow(clippy::trivially_copy_pass_by_ref)]
|
||||
pub fn minus_1(i: &i32) -> i32 {
|
||||
dec_read_dec(&mut i.clone())
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
|
||||
#[warn(cmp_nan)]
|
||||
#[allow(float_cmp, no_effect, unnecessary_operation)]
|
||||
#[warn(clippy::cmp_nan)]
|
||||
#[allow(clippy::float_cmp, clippy::no_effect, clippy::unnecessary_operation)]
|
||||
fn main() {
|
||||
let x = 5f32;
|
||||
x == std::f32::NAN;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
#![warn(cmp_null)]
|
||||
#![warn(clippy::cmp_null)]
|
||||
#![allow(unused_mut)]
|
||||
|
||||
use std::ptr;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
|
||||
#[warn(cmp_owned)]
|
||||
#[allow(unnecessary_operation)]
|
||||
#[warn(clippy::cmp_owned)]
|
||||
#[allow(clippy::unnecessary_operation)]
|
||||
fn main() {
|
||||
fn with_to_string(x : &str) {
|
||||
x != "foo".to_string();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
|
||||
#[warn(collapsible_if)]
|
||||
#[warn(clippy::collapsible_if)]
|
||||
fn main() {
|
||||
let x = "hello";
|
||||
let y = "world";
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
#![warn(clippy)]
|
||||
#![allow(unused, needless_pass_by_value)]
|
||||
#![warn(clippy::all)]
|
||||
#![allow(unused, clippy::needless_pass_by_value)]
|
||||
#![feature(associated_type_defaults)]
|
||||
|
||||
type Alias = Vec<Vec<Box<(u32, u32, u32, u32)>>>; // no warning here
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#![allow(blacklisted_name, collapsible_if, cyclomatic_complexity, eq_op, needless_continue,
|
||||
needless_return, never_loop, no_effect, zero_divided_by_zero)]
|
||||
#![feature(tool_lints)]
|
||||
|
||||
#![allow(clippy::blacklisted_name, clippy::collapsible_if, clippy::cyclomatic_complexity, clippy::eq_op, clippy::needless_continue,
|
||||
clippy::needless_return, clippy::never_loop, clippy::no_effect, clippy::zero_divided_by_zero)]
|
||||
|
||||
fn bar<T>(_: T) {}
|
||||
fn foo() -> bool { unimplemented!() }
|
||||
|
@ -14,8 +16,8 @@ pub enum Abc {
|
|||
C,
|
||||
}
|
||||
|
||||
#[warn(if_same_then_else)]
|
||||
#[warn(match_same_arms)]
|
||||
#[warn(clippy::if_same_then_else)]
|
||||
#[warn(clippy::match_same_arms)]
|
||||
fn if_same_then_else() -> Result<&'static str, ()> {
|
||||
if true {
|
||||
Foo { bar: 42 };
|
||||
|
@ -340,8 +342,8 @@ fn if_same_then_else() -> Result<&'static str, ()> {
|
|||
}
|
||||
}
|
||||
|
||||
#[warn(ifs_same_cond)]
|
||||
#[allow(if_same_then_else)] // all empty blocks
|
||||
#[warn(clippy::ifs_same_cond)]
|
||||
#[allow(clippy::if_same_then_else)] // all empty blocks
|
||||
fn ifs_same_cond() {
|
||||
let a = 0;
|
||||
let b = false;
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
#![warn(copy_iterator)]
|
||||
#![feature(tool_lints)]
|
||||
|
||||
#![warn(clippy::copy_iterator)]
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
struct Countdown(u8);
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
fn main() {}
|
||||
|
||||
#[allow(result_unwrap_used)]
|
||||
#[allow(clippy::result_unwrap_used)]
|
||||
fn temporary_cstring() {
|
||||
use std::ffi::CString;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
#![allow(clippy)]
|
||||
#![warn(cyclomatic_complexity)]
|
||||
#![allow(clippy::all)]
|
||||
#![warn(clippy::cyclomatic_complexity)]
|
||||
#![allow(unused)]
|
||||
|
||||
fn main() {
|
||||
|
@ -172,7 +172,7 @@ fn bar() {
|
|||
|
||||
#[test]
|
||||
#[clippy::cyclomatic_complexity = "0"]
|
||||
/// Tests are usually complex but simple at the same time. `cyclomatic_complexity` used to give
|
||||
/// Tests are usually complex but simple at the same time. `clippy::cyclomatic_complexity` used to give
|
||||
/// lots of false-positives in tests.
|
||||
fn dont_warn_on_tests() {
|
||||
match 99 {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
#![warn(cyclomatic_complexity)]
|
||||
#![warn(clippy::cyclomatic_complexity)]
|
||||
#![warn(unused)]
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
|
||||
#[warn(decimal_literal_representation)]
|
||||
#[warn(clippy::decimal_literal_representation)]
|
||||
#[allow(unused_variables)]
|
||||
fn main() {
|
||||
let good = ( // Hex:
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
#![warn(default_trait_access)]
|
||||
#![feature(tool_lints)]
|
||||
|
||||
#![warn(clippy::default_trait_access)]
|
||||
|
||||
use std::default::Default as D2;
|
||||
use std::string;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
|
||||
#![feature(tool_lints)]
|
||||
|
||||
#![feature(untagged_unions)]
|
||||
|
||||
#![allow(dead_code)]
|
||||
#![warn(expl_impl_clone_on_copy)]
|
||||
#![warn(clippy::expl_impl_clone_on_copy)]
|
||||
|
||||
use std::hash::{Hash, Hasher};
|
||||
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
#![feature(never_type)]
|
||||
|
||||
#![warn(diverging_sub_expression)]
|
||||
#![allow(match_same_arms, logic_bug)]
|
||||
#![warn(clippy::diverging_sub_expression)]
|
||||
#![allow(clippy::match_same_arms, clippy::logic_bug)]
|
||||
|
||||
#[allow(empty_loop)]
|
||||
#[allow(clippy::empty_loop)]
|
||||
fn diverge() -> ! { loop {} }
|
||||
|
||||
struct A;
|
||||
|
@ -12,7 +14,7 @@ impl A {
|
|||
fn foo(&self) -> ! { diverge() }
|
||||
}
|
||||
|
||||
#[allow(unused_variables, unnecessary_operation, short_circuit_statement)]
|
||||
#[allow(unused_variables, clippy::unnecessary_operation, clippy::short_circuit_statement)]
|
||||
fn main() {
|
||||
let b = true;
|
||||
b || diverge();
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
#![feature(alloc)]
|
||||
#![feature(associated_type_defaults)]
|
||||
|
||||
|
||||
#![warn(linkedlist)]
|
||||
#![allow(dead_code, needless_pass_by_value)]
|
||||
#![warn(clippy::linkedlist)]
|
||||
#![allow(dead_code, clippy::needless_pass_by_value)]
|
||||
|
||||
extern crate alloc;
|
||||
use alloc::collections::linked_list::LinkedList;
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
//! This file tests for the DOC_MARKDOWN lint
|
||||
|
||||
|
||||
|
||||
#![allow(dead_code)]
|
||||
#![warn(doc_markdown)]
|
||||
#![warn(clippy::doc_markdown)]
|
||||
|
||||
/// The foo_bar function does _nothing_. See also foo::bar. (note the dot there)
|
||||
/// Markdown is _weird_. I mean _really weird_. This \_ is ok. So is `_`. But not Foo::some_fun
|
||||
|
@ -50,7 +52,7 @@ fn test_units() {
|
|||
}
|
||||
|
||||
/// This test has [a link_with_underscores][chunked-example] inside it. See #823.
|
||||
/// See also [the issue tracker](https://github.com/rust-lang-nursery/rust-clippy/search?q=doc_markdown&type=Issues)
|
||||
/// See also [the issue tracker](https://github.com/rust-lang-nursery/rust-clippy/search?q=clippy::doc_markdown&type=Issues)
|
||||
/// on GitHub (which is a camel-cased word, but is OK). And here is another [inline link][inline_link].
|
||||
/// It can also be [inline_link2].
|
||||
///
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
|
||||
#[warn(double_neg)]
|
||||
#[warn(clippy::double_neg)]
|
||||
fn main() {
|
||||
let x = 1;
|
||||
-x;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
|
||||
#![warn(double_parens)]
|
||||
#![warn(clippy::double_parens)]
|
||||
#![allow(dead_code)]
|
||||
|
||||
fn dummy_fn<T>(_: T) {}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
|
||||
#![warn(drop_copy, forget_copy)]
|
||||
#![allow(toplevel_ref_arg, drop_ref, forget_ref, unused_mut)]
|
||||
#![warn(clippy::drop_copy, clippy::forget_copy)]
|
||||
#![allow(clippy::toplevel_ref_arg, clippy::drop_ref, clippy::forget_ref, unused_mut)]
|
||||
|
||||
use std::mem::{drop, forget};
|
||||
use std::vec::Vec;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
|
||||
#![warn(drop_ref, forget_ref)]
|
||||
#![allow(toplevel_ref_arg, similar_names, needless_pass_by_value)]
|
||||
#![warn(clippy::drop_ref, clippy::forget_ref)]
|
||||
#![allow(clippy::toplevel_ref_arg, clippy::similar_names, clippy::needless_pass_by_value)]
|
||||
|
||||
use std::mem::{drop, forget};
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
|
||||
#![warn(duplicate_underscore_argument)]
|
||||
#![warn(clippy::duplicate_underscore_argument)]
|
||||
#[allow(dead_code, unused)]
|
||||
|
||||
fn join_the_dark_side(darth: i32, _darth: i32) {}
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
#![warn(duration_subsec)]
|
||||
#![feature(tool_lints)]
|
||||
|
||||
#![warn(clippy::duration_subsec)]
|
||||
|
||||
use std::time::Duration;
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#![warn(clippy)]
|
||||
#![warn(else_if_without_else)]
|
||||
#![feature(tool_lints)]
|
||||
|
||||
#![warn(clippy::all)]
|
||||
#![warn(clippy::else_if_without_else)]
|
||||
|
||||
fn bla1() -> bool { unimplemented!() }
|
||||
fn bla2() -> bool { unimplemented!() }
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
#![allow(dead_code)]
|
||||
#![warn(empty_enum)]
|
||||
#![warn(clippy::empty_enum)]
|
||||
|
||||
enum Empty {}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
#![warn(empty_line_after_outer_attr)]
|
||||
#![feature(tool_lints)]
|
||||
#![warn(clippy::empty_line_after_outer_attr)]
|
||||
|
||||
// This should produce a warning
|
||||
#[crate_type = "lib"]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
#![allow(unused, clippy::needless_pass_by_value)]
|
||||
|
||||
#![allow(unused, needless_pass_by_value)]
|
||||
|
||||
#![warn(map_entry)]
|
||||
#![warn(clippy::map_entry)]
|
||||
|
||||
use std::collections::{BTreeMap, HashMap};
|
||||
use std::hash::Hash;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
#![warn(clippy, clippy_pedantic)]
|
||||
#![allow(unused_imports, dead_code, missing_docs_in_private_items)]
|
||||
#![warn(clippy::all, clippy::pedantic)]
|
||||
#![allow(unused_imports, dead_code, clippy::missing_docs_in_private_items)]
|
||||
|
||||
use std::cmp::Ordering::*;
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
#![feature(non_ascii_idents)]
|
||||
|
||||
#![warn(clippy, pub_enum_variant_names)]
|
||||
#![warn(clippy::all, clippy::pub_enum_variant_names)]
|
||||
|
||||
enum FakeCallType {
|
||||
CALL, CREATE
|
||||
|
@ -93,7 +95,7 @@ pub enum PubSeall {
|
|||
WithOut,
|
||||
}
|
||||
|
||||
#[allow(pub_enum_variant_names)]
|
||||
#[allow(clippy::pub_enum_variant_names)]
|
||||
mod allowed {
|
||||
pub enum PubAllowed {
|
||||
SomeThis,
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
// ignore-x86
|
||||
|
||||
|
||||
#![warn(clippy)]
|
||||
#![warn(clippy::all)]
|
||||
|
||||
#![allow(unused)]
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
|
||||
#[warn(eq_op)]
|
||||
#[allow(identity_op, double_parens, many_single_char_names)]
|
||||
#[allow(no_effect, unused_variables, unnecessary_operation, short_circuit_statement)]
|
||||
#[warn(nonminimal_bool)]
|
||||
#[warn(clippy::eq_op)]
|
||||
#[allow(clippy::identity_op, clippy::double_parens, clippy::many_single_char_names)]
|
||||
#[allow(clippy::no_effect, unused_variables, clippy::unnecessary_operation, clippy::short_circuit_statement)]
|
||||
#[warn(clippy::nonminimal_bool)]
|
||||
fn main() {
|
||||
// simple values and comparisons
|
||||
1 == 1;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
|
||||
#[allow(no_effect)]
|
||||
#[warn(erasing_op)]
|
||||
#[allow(clippy::no_effect)]
|
||||
#[warn(clippy::erasing_op)]
|
||||
fn main() {
|
||||
let x: u8 = 0;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
#![allow(unknown_lints, unused, no_effect, redundant_closure_call, many_single_char_names, needless_pass_by_value, option_map_unit_fn, trivially_copy_pass_by_ref)]
|
||||
#![warn(redundant_closure, needless_borrow)]
|
||||
#![allow(unknown_lints, unused, clippy::no_effect, clippy::redundant_closure_call, clippy::many_single_char_names, clippy::needless_pass_by_value, clippy::option_map_unit_fn, clippy::trivially_copy_pass_by_ref)]
|
||||
#![warn(clippy::redundant_closure, clippy::needless_borrow)]
|
||||
|
||||
fn main() {
|
||||
let a = Some(1u8).map(|a| foo(a));
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
|
||||
#[warn(eval_order_dependence)]
|
||||
#[allow(unused_assignments, unused_variables, many_single_char_names, no_effect, dead_code, blacklisted_name)]
|
||||
#[warn(clippy::eval_order_dependence)]
|
||||
#[allow(unused_assignments, unused_variables, clippy::many_single_char_names, clippy::no_effect, dead_code, clippy::blacklisted_name)]
|
||||
fn main() {
|
||||
let mut x = 0;
|
||||
let a = { x = 1; 1 } + x;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
#![warn(excessive_precision)]
|
||||
#![allow(print_literal)]
|
||||
#![feature(tool_lints)]
|
||||
#![warn(clippy::excessive_precision)]
|
||||
#![allow(clippy::print_literal)]
|
||||
|
||||
fn main() {
|
||||
// Consts
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
#![warn(explicit_write)]
|
||||
#![feature(tool_lints)]
|
||||
|
||||
#![warn(clippy::explicit_write)]
|
||||
|
||||
|
||||
fn stdout() -> String {
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
#![deny(fallible_impl_from)]
|
||||
#![feature(tool_lints)]
|
||||
|
||||
#![deny(clippy::fallible_impl_from)]
|
||||
|
||||
// docs example
|
||||
struct Foo(i32);
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
|
||||
#![warn(clippy, clippy_pedantic)]
|
||||
#![allow(missing_docs_in_private_items)]
|
||||
#![warn(clippy::all, clippy::pedantic)]
|
||||
#![allow(clippy::missing_docs_in_private_items)]
|
||||
|
||||
fn main() {
|
||||
let _: Vec<_> = vec![5; 6].into_iter()
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
|
||||
#![warn(float_cmp)]
|
||||
#![allow(unused, no_effect, unnecessary_operation, cast_lossless)]
|
||||
#![warn(clippy::float_cmp)]
|
||||
#![allow(unused, clippy::no_effect, clippy::unnecessary_operation, clippy::cast_lossless)]
|
||||
|
||||
use std::ops::Add;
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
|
||||
#![warn(float_cmp_const)]
|
||||
#![allow(float_cmp)]
|
||||
#![allow(unused, no_effect, unnecessary_operation)]
|
||||
#![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;
|
||||
|
@ -36,7 +36,7 @@ fn main() {
|
|||
ONE != ::std::f32::INFINITY;
|
||||
ONE == ::std::f32::NEG_INFINITY;
|
||||
|
||||
// no errors, but will warn float_cmp if '#![allow(float_cmp)]' above is removed
|
||||
// no errors, but will warn clippy::float_cmp if '#![allow(float_cmp)]' above is removed
|
||||
let w = 1.1;
|
||||
v == w;
|
||||
v != w;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
use std::collections::*;
|
||||
|
@ -7,7 +7,7 @@ use std::rc::Rc;
|
|||
static STATIC: [usize; 4] = [0, 1, 8, 16];
|
||||
const CONST: [usize; 4] = [0, 1, 8, 16];
|
||||
|
||||
#[warn(clippy)]
|
||||
#[warn(clippy::all)]
|
||||
fn for_loop_over_option_and_result() {
|
||||
let option = Some(1);
|
||||
let result = option.ok_or("x not found");
|
||||
|
@ -27,7 +27,7 @@ fn for_loop_over_option_and_result() {
|
|||
println!("{}", x);
|
||||
}
|
||||
|
||||
// make sure LOOP_OVER_NEXT lint takes precedence when next() is the last call
|
||||
// make sure LOOP_OVER_NEXT lint takes clippy::precedence when next() is the last call
|
||||
// in the chain
|
||||
for x in v.iter().next() {
|
||||
println!("{}", x);
|
||||
|
@ -73,11 +73,11 @@ impl Unrelated {
|
|||
}
|
||||
}
|
||||
|
||||
#[warn(needless_range_loop, explicit_iter_loop, explicit_into_iter_loop, iter_next_loop, reverse_range_loop,
|
||||
explicit_counter_loop, for_kv_map)]
|
||||
#[warn(unused_collect)]
|
||||
#[allow(linkedlist, shadow_unrelated, unnecessary_mut_passed, cyclomatic_complexity, similar_names)]
|
||||
#[allow(many_single_char_names, unused_variables)]
|
||||
#[warn(clippy::needless_range_loop, clippy::explicit_iter_loop, clippy::explicit_into_iter_loop, clippy::iter_next_loop, clippy::reverse_range_loop,
|
||||
clippy::explicit_counter_loop, clippy::for_kv_map)]
|
||||
#[warn(clippy::unused_collect)]
|
||||
#[allow(clippy::linkedlist, clippy::shadow_unrelated, clippy::unnecessary_mut_passed, clippy::cyclomatic_complexity, clippy::similar_names)]
|
||||
#[allow(clippy::many_single_char_names, unused_variables)]
|
||||
fn main() {
|
||||
const MAX_LEN: usize = 42;
|
||||
|
||||
|
@ -429,7 +429,7 @@ fn main() {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(used_underscore_binding)]
|
||||
#[allow(clippy::used_underscore_binding)]
|
||||
fn test_for_kv_map() {
|
||||
let m: HashMap<u64, u64> = HashMap::new();
|
||||
|
||||
|
@ -456,7 +456,7 @@ fn partition<T: PartialOrd + Send>(v: &mut [T]) -> usize {
|
|||
|
||||
const LOOP_OFFSET: usize = 5000;
|
||||
|
||||
#[warn(needless_range_loop)]
|
||||
#[warn(clippy::needless_range_loop)]
|
||||
pub fn manual_copy(src: &[i32], dst: &mut [i32], dst2: &mut [i32]) {
|
||||
// plain manual memcpy
|
||||
for i in 0..src.len() {
|
||||
|
@ -542,14 +542,14 @@ pub fn manual_copy(src: &[i32], dst: &mut [i32], dst2: &mut [i32]) {
|
|||
}
|
||||
}
|
||||
|
||||
#[warn(needless_range_loop)]
|
||||
#[warn(clippy::needless_range_loop)]
|
||||
pub fn manual_clone(src: &[String], dst: &mut [String]) {
|
||||
for i in 0..src.len() {
|
||||
dst[i] = src[i].clone();
|
||||
}
|
||||
}
|
||||
|
||||
#[warn(needless_range_loop)]
|
||||
#[warn(clippy::needless_range_loop)]
|
||||
pub fn manual_copy_same_destination(dst: &mut [i32], d: usize, s: usize) {
|
||||
// Same source and destination - don't trigger lint
|
||||
for i in 0..dst.len() {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
#![allow(print_literal)]
|
||||
#![warn(useless_format)]
|
||||
#![feature(tool_lints)]
|
||||
#![allow(clippy::print_literal)]
|
||||
#![warn(clippy::useless_format)]
|
||||
|
||||
struct Foo(pub String);
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
|
||||
#![warn(clippy)]
|
||||
#![warn(clippy::all)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(unused_assignments)]
|
||||
#![allow(if_same_then_else)]
|
||||
#![allow(deref_addrof)]
|
||||
#![allow(clippy::if_same_then_else)]
|
||||
#![allow(clippy::deref_addrof)]
|
||||
|
||||
fn foo() -> bool { true }
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
|
||||
#![warn(clippy)]
|
||||
#![warn(clippy::all)]
|
||||
#![allow(dead_code)]
|
||||
#![allow(unused_unsafe)]
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
#![warn(default_hash_types)]
|
||||
#![feature(tool_lints)]
|
||||
|
||||
#![warn(clippy::default_hash_types)]
|
||||
#![feature(rustc_private)]
|
||||
|
||||
extern crate rustc_data_structures;
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
#![deny(identity_conversion)]
|
||||
#![feature(tool_lints)]
|
||||
|
||||
#![deny(clippy::identity_conversion)]
|
||||
|
||||
fn test_generic<T: Copy>(val: T) -> T {
|
||||
let _ = T::from(val);
|
||||
|
@ -28,7 +30,7 @@ fn main() {
|
|||
let _: String = "foo".into();
|
||||
let _: String = From::from("foo");
|
||||
let _ = String::from("foo");
|
||||
#[allow(identity_conversion)]
|
||||
#[allow(clippy::identity_conversion)]
|
||||
{
|
||||
let _: String = "foo".into();
|
||||
let _ = String::from("foo");
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
|
||||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
const ONE : i64 = 1;
|
||||
const NEG_ONE : i64 = -1;
|
||||
const ZERO : i64 = 0;
|
||||
|
||||
#[allow(eq_op, no_effect, unnecessary_operation, double_parens)]
|
||||
#[warn(identity_op)]
|
||||
#[allow(clippy::eq_op, clippy::no_effect, clippy::unnecessary_operation, clippy::double_parens)]
|
||||
#[warn(clippy::identity_op)]
|
||||
fn main() {
|
||||
let x = 0;
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
|
||||
#![warn(clippy)]
|
||||
#![warn(if_let_redundant_pattern_matching)]
|
||||
#![warn(clippy::all)]
|
||||
#![warn(clippy::if_let_redundant_pattern_matching)]
|
||||
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
#![warn(clippy)]
|
||||
#![warn(if_not_else)]
|
||||
#![warn(clippy::all)]
|
||||
#![warn(clippy::if_not_else)]
|
||||
|
||||
fn bla() -> bool { unimplemented!() }
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
#![allow(dead_code)]
|
||||
#![warn(multiple_inherent_impl)]
|
||||
#![warn(clippy::multiple_inherent_impl)]
|
||||
|
||||
struct MyStruct;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
#[warn(inconsistent_digit_grouping)]
|
||||
#[warn(clippy::inconsistent_digit_grouping)]
|
||||
#[allow(unused_variables)]
|
||||
fn main() {
|
||||
let good = (123, 1_234, 1_2345_6789, 123_f32, 1_234.12_f32, 1_234.123_4_f32, 1.123_456_7_f32);
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
#![feature(plugin)]
|
||||
#![warn(indexing_slicing)]
|
||||
#![warn(out_of_bounds_indexing)]
|
||||
#![allow(no_effect, unnecessary_operation)]
|
||||
#![warn(clippy::indexing_slicing)]
|
||||
#![warn(clippy::out_of_bounds_indexing)]
|
||||
#![allow(clippy::no_effect, clippy::unnecessary_operation)]
|
||||
|
||||
fn main() {
|
||||
let x = [1, 2, 3, 4];
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
#![feature(exhaustive_patterns, never_type)]
|
||||
#![allow(let_and_return)]
|
||||
#![allow(clippy::let_and_return)]
|
||||
|
||||
enum SingleVariantEnum {
|
||||
Variant(i32),
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
|
||||
#![feature(tool_lints)]
|
||||
|
||||
use std::iter::repeat;
|
||||
#[allow(trivially_copy_pass_by_ref)]
|
||||
#[allow(clippy::trivially_copy_pass_by_ref)]
|
||||
fn square_is_lower_64(x: &u32) -> bool { x * x < 64 }
|
||||
|
||||
#[allow(maybe_infinite_iter)]
|
||||
#[deny(infinite_iter)]
|
||||
#[allow(clippy::maybe_infinite_iter)]
|
||||
#[deny(clippy::infinite_iter)]
|
||||
fn infinite_iters() {
|
||||
repeat(0_u8).collect::<Vec<_>>(); // infinite iter
|
||||
(0..8_u32).take_while(square_is_lower_64).cycle().count(); // infinite iter
|
||||
|
@ -19,7 +19,7 @@ fn infinite_iters() {
|
|||
(0..).next(); // iterator is not exhausted
|
||||
}
|
||||
|
||||
#[deny(maybe_infinite_iter)]
|
||||
#[deny(clippy::maybe_infinite_iter)]
|
||||
fn potential_infinite_iters() {
|
||||
(0..).zip((0..).take_while(square_is_lower_64)).count(); // maybe infinite iter
|
||||
repeat(42).take_while(|x| *x == 42).chain(0..42).max(); // maybe infinite iter
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
#![allow(trivially_copy_pass_by_ref)]
|
||||
#![feature(tool_lints)]
|
||||
|
||||
#![allow(clippy::trivially_copy_pass_by_ref)]
|
||||
|
||||
|
||||
fn fn_val(i: i32) -> i32 { unimplemented!() }
|
||||
|
@ -7,7 +9,7 @@ fn fn_mutref(i: &mut i32) { unimplemented!() }
|
|||
fn fooi() -> i32 { unimplemented!() }
|
||||
fn foob() -> bool { unimplemented!() }
|
||||
|
||||
#[allow(many_single_char_names)]
|
||||
#[allow(clippy::many_single_char_names)]
|
||||
fn immutable_condition() {
|
||||
// Should warn when all vars mentioned are immutable
|
||||
let y = 0;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
|
||||
#![warn(inline_fn_without_body)]
|
||||
#![allow(inline_always)]
|
||||
#![warn(clippy::inline_fn_without_body)]
|
||||
#![allow(clippy::inline_always)]
|
||||
|
||||
trait Foo {
|
||||
#[inline]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
|
||||
#[allow(no_effect, unnecessary_operation)]
|
||||
#[warn(int_plus_one)]
|
||||
#[allow(clippy::no_effect, clippy::unnecessary_operation)]
|
||||
#[warn(clippy::int_plus_one)]
|
||||
fn main() {
|
||||
let x = 1i32;
|
||||
let y = 0i32;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
|
||||
#![warn(invalid_upcast_comparisons)]
|
||||
#![allow(unused, eq_op, no_effect, unnecessary_operation, cast_lossless)]
|
||||
#![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!() }
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
#![deny(while_let_on_iterator)]
|
||||
#![feature(tool_lints)]
|
||||
|
||||
#![deny(clippy::while_let_on_iterator)]
|
||||
|
||||
use std::iter::Iterator;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
#![warn(items_after_statements)]
|
||||
#![warn(clippy::items_after_statements)]
|
||||
|
||||
fn ok() {
|
||||
fn foo() { println!("foo"); }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
#[warn(large_digit_groups)]
|
||||
#[warn(clippy::large_digit_groups)]
|
||||
#[allow(unused_variables)]
|
||||
fn main() {
|
||||
let good = (0b1011_i64, 0o1_234_u32, 0x1_234_567, 1_2345_6789, 1234_f32, 1_234.12_f32, 1_234.123_f32, 1.123_4_f32);
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
|
||||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
#![allow(dead_code)]
|
||||
#![allow(unused_variables)]
|
||||
#![warn(large_enum_variant)]
|
||||
#![warn(clippy::large_enum_variant)]
|
||||
|
||||
enum LargeEnum {
|
||||
A(i32),
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
#![warn(len_without_is_empty, len_zero)]
|
||||
#![feature(tool_lints)]
|
||||
|
||||
#![warn(clippy::len_without_is_empty, clippy::len_zero)]
|
||||
#![allow(dead_code, unused)]
|
||||
|
||||
pub struct PubOne;
|
||||
|
@ -19,7 +21,7 @@ impl PubOne {
|
|||
// Identical to PubOne, but with an allow attribute on the impl complaining len
|
||||
pub struct PubAllowed;
|
||||
|
||||
#[allow(len_without_is_empty)]
|
||||
#[allow(clippy::len_without_is_empty)]
|
||||
impl PubAllowed {
|
||||
pub fn len(self: &Self) -> isize {
|
||||
1
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
|
||||
#![allow(unused_variables, unused_assignments, similar_names, blacklisted_name)]
|
||||
#![warn(useless_let_if_seq)]
|
||||
#![allow(unused_variables, unused_assignments, clippy::similar_names, clippy::blacklisted_name)]
|
||||
#![warn(clippy::useless_let_if_seq)]
|
||||
|
||||
fn f() -> bool { true }
|
||||
fn g(x: i32) -> i32 { x + 1 }
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
#![feature(tool_lints)]
|
||||
|
||||
#![allow(unused)]
|
||||
|
||||
#![warn(let_and_return)]
|
||||
#![warn(clippy::let_and_return)]
|
||||
|
||||
fn test() -> i32 {
|
||||
let _y = 0; // no warning
|
||||
|
@ -37,7 +37,7 @@ fn test_nowarn_3() -> (i32, i32) {
|
|||
}
|
||||
|
||||
fn test_nowarn_4() -> i32 {
|
||||
// this should technically warn, but not b/c of let_and_return, but b/c of useless type
|
||||
// this should technically warn, but not b/c of clippy::let_and_return, but b/c of useless type
|
||||
let x: i32 = 5;
|
||||
x
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
|
||||
#![warn(let_unit_value)]
|
||||
#![warn(clippy::let_unit_value)]
|
||||
#![allow(unused_variables)]
|
||||
|
||||
macro_rules! let_and_return {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
|
||||
#![warn(needless_lifetimes, extra_unused_lifetimes)]
|
||||
#![allow(dead_code, needless_pass_by_value, trivially_copy_pass_by_ref)]
|
||||
#![warn(clippy::needless_lifetimes, clippy::extra_unused_lifetimes)]
|
||||
#![allow(dead_code, clippy::needless_pass_by_value, clippy::trivially_copy_pass_by_ref)]
|
||||
|
||||
fn distinct_lifetimes<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: u8) { }
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#![warn(mixed_case_hex_literals)]
|
||||
#![warn(unseparated_literal_suffix)]
|
||||
#![warn(zero_prefixed_literal)]
|
||||
#![feature(tool_lints)]
|
||||
|
||||
#![warn(clippy::mixed_case_hex_literals)]
|
||||
#![warn(clippy::unseparated_literal_suffix)]
|
||||
#![warn(clippy::zero_prefixed_literal)]
|
||||
#![allow(dead_code)]
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
#![warn(clippy::map_clone)]
|
||||
|
||||
#![warn(map_clone)]
|
||||
|
||||
#![allow(clone_on_copy, unused)]
|
||||
#![allow(clippy::clone_on_copy, unused)]
|
||||
|
||||
use std::ops::Deref;
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
|
||||
#![feature(tool_lints)]
|
||||
#![feature(exclusive_range_pattern)]
|
||||
|
||||
|
||||
#![warn(clippy)]
|
||||
#![allow(unused, if_let_redundant_pattern_matching)]
|
||||
#![warn(single_match_else, match_same_arms)]
|
||||
#![warn(clippy::all)]
|
||||
#![allow(unused, clippy::if_let_redundant_pattern_matching)]
|
||||
#![warn(clippy::single_match_else, clippy::match_same_arms)]
|
||||
|
||||
enum ExprNode {
|
||||
ExprAddrOf,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
|
||||
|
@ -8,8 +8,8 @@ use std::rc::Rc;
|
|||
use std::mem::forget as forgetSomething;
|
||||
use std::mem as memstuff;
|
||||
|
||||
#[warn(mem_forget)]
|
||||
#[allow(forget_copy)]
|
||||
#[warn(clippy::mem_forget)]
|
||||
#[allow(clippy::forget_copy)]
|
||||
fn main() {
|
||||
let five: i32 = 5;
|
||||
forgetSomething(five);
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
|
||||
#![feature(tool_lints)]
|
||||
#![feature(const_fn)]
|
||||
|
||||
#![warn(clippy, clippy_pedantic, option_unwrap_used)]
|
||||
#![allow(blacklisted_name, unused, print_stdout, non_ascii_literal, new_without_default,
|
||||
new_without_default_derive, missing_docs_in_private_items, needless_pass_by_value,
|
||||
default_trait_access, use_self)]
|
||||
#![warn(clippy::all, clippy::pedantic, clippy::option_unwrap_used)]
|
||||
#![allow(clippy::blacklisted_name, unused, clippy::print_stdout, clippy::non_ascii_literal, clippy::new_without_default,
|
||||
clippy::new_without_default_derive, clippy::missing_docs_in_private_items, clippy::needless_pass_by_value,
|
||||
clippy::default_trait_access, clippy::use_self)]
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
use std::collections::HashMap;
|
||||
|
@ -42,7 +42,7 @@ struct Lt<'a> {
|
|||
|
||||
impl<'a> Lt<'a> {
|
||||
// The lifetime is different, but that’s irrelevant, see #734
|
||||
#[allow(needless_lifetimes)]
|
||||
#[allow(clippy::needless_lifetimes)]
|
||||
pub fn new<'b>(s: &'b str) -> Lt<'b> { unimplemented!() }
|
||||
}
|
||||
|
||||
|
@ -438,7 +438,7 @@ fn iter_skip_next() {
|
|||
let _ = foo.filter().skip(42).next();
|
||||
}
|
||||
|
||||
#[allow(similar_names)]
|
||||
#[allow(clippy::similar_names)]
|
||||
fn main() {
|
||||
let opt = Some(0);
|
||||
let _ = opt.unwrap();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
|
||||
#![warn(clippy)]
|
||||
#![warn(clippy::all)]
|
||||
|
||||
use std::cmp::{min, max};
|
||||
use std::cmp::min as my_min;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
/* This file incorporates work covered by the following copyright and
|
||||
* permission notice:
|
||||
* Copyright 2013 The Rust Project Developers. See the COPYRIGHT
|
||||
|
@ -13,7 +15,7 @@
|
|||
|
||||
|
||||
|
||||
#![warn(missing_docs_in_private_items)]
|
||||
#![warn(clippy::missing_docs_in_private_items)]
|
||||
|
||||
// When denying at the crate level, be sure to not get random warnings from the
|
||||
// injected intrinsics by the compiler.
|
||||
|
@ -36,7 +38,7 @@ pub struct PubFoo {
|
|||
b: isize,
|
||||
}
|
||||
|
||||
#[allow(missing_docs_in_private_items)]
|
||||
#[allow(clippy::missing_docs_in_private_items)]
|
||||
pub struct PubFoo2 {
|
||||
pub a: isize,
|
||||
pub c: isize,
|
||||
|
@ -49,7 +51,7 @@ pub mod pub_module_no_dox {}
|
|||
pub fn foo() {}
|
||||
pub fn foo2() {}
|
||||
fn foo3() {}
|
||||
#[allow(missing_docs_in_private_items)] pub fn foo4() {}
|
||||
#[allow(clippy::missing_docs_in_private_items)] pub fn foo4() {}
|
||||
|
||||
/// dox
|
||||
pub trait A {
|
||||
|
@ -59,7 +61,7 @@ pub trait A {
|
|||
fn foo_with_impl(&self) {}
|
||||
}
|
||||
|
||||
#[allow(missing_docs_in_private_items)]
|
||||
#[allow(clippy::missing_docs_in_private_items)]
|
||||
trait B {
|
||||
fn foo(&self);
|
||||
fn foo_with_impl(&self) {}
|
||||
|
@ -70,7 +72,7 @@ pub trait C {
|
|||
fn foo_with_impl(&self) {}
|
||||
}
|
||||
|
||||
#[allow(missing_docs_in_private_items)]
|
||||
#[allow(clippy::missing_docs_in_private_items)]
|
||||
pub trait D {
|
||||
fn dummy(&self) { }
|
||||
}
|
||||
|
@ -98,10 +100,10 @@ impl PubFoo {
|
|||
/// dox
|
||||
pub fn foo1() {}
|
||||
fn foo2() {}
|
||||
#[allow(missing_docs_in_private_items)] pub fn foo3() {}
|
||||
#[allow(clippy::missing_docs_in_private_items)] pub fn foo3() {}
|
||||
}
|
||||
|
||||
#[allow(missing_docs_in_private_items)]
|
||||
#[allow(clippy::missing_docs_in_private_items)]
|
||||
trait F {
|
||||
fn a();
|
||||
fn b(&self);
|
||||
|
@ -146,7 +148,7 @@ pub enum PubBaz2 {
|
|||
},
|
||||
}
|
||||
|
||||
#[allow(missing_docs_in_private_items)]
|
||||
#[allow(clippy::missing_docs_in_private_items)]
|
||||
pub enum PubBaz3 {
|
||||
PubBaz3A {
|
||||
b: isize
|
||||
|
@ -160,7 +162,7 @@ pub fn baz() {}
|
|||
const FOO: u32 = 0;
|
||||
/// dox
|
||||
pub const FOO1: u32 = 0;
|
||||
#[allow(missing_docs_in_private_items)]
|
||||
#[allow(clippy::missing_docs_in_private_items)]
|
||||
pub const FOO2: u32 = 0;
|
||||
#[doc(hidden)]
|
||||
pub const FOO3: u32 = 0;
|
||||
|
@ -170,7 +172,7 @@ pub const FOO4: u32 = 0;
|
|||
static BAR: u32 = 0;
|
||||
/// dox
|
||||
pub static BAR1: u32 = 0;
|
||||
#[allow(missing_docs_in_private_items)]
|
||||
#[allow(clippy::missing_docs_in_private_items)]
|
||||
pub static BAR2: u32 = 0;
|
||||
#[doc(hidden)]
|
||||
pub static BAR3: u32 = 0;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
/* This file incorporates work covered by the following copyright and
|
||||
* permission notice:
|
||||
* Copyright 2013 The Rust Project Developers. See the COPYRIGHT
|
||||
|
@ -10,7 +12,7 @@
|
|||
* option. This file may not be copied, modified, or distributed
|
||||
* except according to those terms.
|
||||
*/
|
||||
#![warn(missing_inline_in_public_items)]
|
||||
#![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.
|
||||
|
@ -32,7 +34,7 @@ pub fn pub_foo() {} // missing #[inline]
|
|||
#[inline] pub fn pub_foo_inline() {} // ok
|
||||
#[inline(always)] pub fn pub_foo_inline_always() {} // ok
|
||||
|
||||
#[allow(missing_inline_in_public_items)]
|
||||
#[allow(clippy::missing_inline_in_public_items)]
|
||||
pub fn pub_foo_no_inline() {}
|
||||
|
||||
trait Bar {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
#![warn(module_inception)]
|
||||
#![warn(clippy::module_inception)]
|
||||
|
||||
mod foo {
|
||||
mod bar {
|
||||
|
@ -16,7 +16,7 @@ mod foo {
|
|||
|
||||
// No warning. See <https://github.com/rust-lang-nursery/rust-clippy/issues/1220>.
|
||||
mod bar {
|
||||
#[allow(module_inception)]
|
||||
#[allow(clippy::module_inception)]
|
||||
mod bar {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
#![warn(modulo_one)]
|
||||
#![allow(no_effect, unnecessary_operation)]
|
||||
#![warn(clippy::modulo_one)]
|
||||
#![allow(clippy::no_effect, clippy::unnecessary_operation)]
|
||||
|
||||
fn main() {
|
||||
10 % 1;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#![feature(tool_lints)]
|
||||
|
||||
|
||||
#![allow(unused, trivially_copy_pass_by_ref)]
|
||||
#![warn(mut_from_ref)]
|
||||
#![allow(unused, clippy::trivially_copy_pass_by_ref)]
|
||||
#![warn(clippy::mut_from_ref)]
|
||||
|
||||
struct Foo;
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue