Skip to content

Commit ffa64de

Browse files
committed
Adating ui-tests to the tool lints
1 parent a3c31c4 commit ffa64de

File tree

174 files changed

+589
-476
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

174 files changed

+589
-476
lines changed

tests/ui/absurd-extreme-comparisons.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
#![feature(tool_lints)]
12

23

3-
4-
#![warn(absurd_extreme_comparisons)]
5-
#![allow(unused, eq_op, no_effect, unnecessary_operation, needless_pass_by_value)]
4+
#![warn(clippy::absurd_extreme_comparisons)]
5+
#![allow(unused, clippy::eq_op, clippy::no_effect, clippy::unnecessary_operation, clippy::needless_pass_by_value)]
66

77
fn main() {
88
const Z: u32 = 0;
@@ -27,7 +27,7 @@ fn main() {
2727
b >= true;
2828
false > b;
2929
u > 0; // ok
30-
// this is handled by unit_cmp
30+
// this is handled by clippy::unit_cmp
3131
() < {};
3232
}
3333

tests/ui/approx_const.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
#![feature(tool_lints)]
12

23

3-
4-
#[warn(approx_constant)]
5-
#[allow(unused, shadow_unrelated, similar_names, unreadable_literal)]
4+
#[warn(clippy::approx_constant)]
5+
#[allow(unused, clippy::shadow_unrelated, clippy::similar_names, clippy::unreadable_literal)]
66
fn main() {
77
let my_e = 2.7182;
88
let almost_e = 2.718;

tests/ui/arithmetic.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
#![feature(tool_lints)]
12

23

3-
4-
#![warn(integer_arithmetic, float_arithmetic)]
5-
#![allow(unused, shadow_reuse, shadow_unrelated, no_effect, unnecessary_operation)]
4+
#![warn(clippy::integer_arithmetic, clippy::float_arithmetic)]
5+
#![allow(unused, clippy::shadow_reuse, clippy::shadow_unrelated, clippy::no_effect, clippy::unnecessary_operation)]
66
fn main() {
77
let i = 1i32;
88
1 + i;

tests/ui/assign_ops.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
#![feature(tool_lints)]
12

23

3-
4-
#[warn(assign_ops)]
4+
#[warn(clippy::assign_ops)]
55
#[allow(unused_assignments)]
66
fn main() {
77
let mut i = 1i32;
@@ -21,7 +21,7 @@ fn main() {
2121
}
2222

2323
#[allow(dead_code, unused_assignments)]
24-
#[warn(assign_op_pattern)]
24+
#[warn(clippy::assign_op_pattern)]
2525
fn bla() {
2626
let mut a = 5;
2727
a = a + 1;

tests/ui/assign_ops2.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
1+
#![feature(tool_lints)]
22

33

44
#[allow(unused_assignments)]
5-
#[warn(misrefactored_assign_op, assign_op_pattern)]
5+
#[warn(clippy::misrefactored_assign_op, clippy::assign_op_pattern)]
66
fn main() {
77
let mut a = 5;
88
a += a + 1;

tests/ui/attrs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
#![feature(tool_lints)]
12

23

3-
4-
#![warn(inline_always, deprecated_semver)]
4+
#![warn(clippy::inline_always, clippy::deprecated_semver)]
55

66
#[inline(always)]
77
fn test_attr_lint() {

tests/ui/bit_masks.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
1+
#![feature(tool_lints)]
22

33

44
const THREE_BITS : i64 = 7;
55
const EVEN_MORE_REDIRECTION : i64 = THREE_BITS;
66

7-
#[warn(bad_bit_mask)]
8-
#[allow(ineffective_bit_mask, identity_op, no_effect, unnecessary_operation)]
7+
#[warn(clippy::bad_bit_mask)]
8+
#[allow(clippy::ineffective_bit_mask, clippy::identity_op, clippy::no_effect, clippy::unnecessary_operation)]
99
fn main() {
1010
let x = 5;
1111

@@ -44,8 +44,8 @@ fn main() {
4444
ineffective();
4545
}
4646

47-
#[warn(ineffective_bit_mask)]
48-
#[allow(bad_bit_mask, no_effect, unnecessary_operation)]
47+
#[warn(clippy::ineffective_bit_mask)]
48+
#[allow(clippy::bad_bit_mask, clippy::no_effect, clippy::unnecessary_operation)]
4949
fn ineffective() {
5050
let x = 5;
5151

tests/ui/blacklisted_name.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
#![feature(tool_lints)]
12

23

3-
4-
#![allow(dead_code, similar_names, single_match, toplevel_ref_arg, unused_mut, unused_variables)]
5-
#![warn(blacklisted_name)]
4+
#![allow(dead_code, clippy::similar_names, clippy::single_match, clippy::toplevel_ref_arg, unused_mut, unused_variables)]
5+
#![warn(clippy::blacklisted_name)]
66

77
fn test(foo: ()) {}
88

tests/ui/block_in_if_condition.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
#![feature(tool_lints)]
12

23

3-
4-
#![warn(block_in_if_condition_expr)]
5-
#![warn(block_in_if_condition_stmt)]
6-
#![allow(unused, let_and_return)]
7-
#![warn(nonminimal_bool)]
4+
#![warn(clippy::block_in_if_condition_expr)]
5+
#![warn(clippy::block_in_if_condition_stmt)]
6+
#![allow(unused, clippy::let_and_return)]
7+
#![warn(clippy::nonminimal_bool)]
88

99

1010
macro_rules! blocky {

tests/ui/bool_comparison.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
#![feature(tool_lints)]
12

23

3-
4-
#[warn(bool_comparison)]
4+
#[warn(clippy::bool_comparison)]
55
fn main() {
66
let x = true;
77
if x == true { "yes" } else { "no" };

tests/ui/booleans.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
#![feature(tool_lints)]
12

3+
#![warn(clippy::nonminimal_bool, clippy::logic_bug)]
24

3-
#![warn(nonminimal_bool, logic_bug)]
4-
5-
#[allow(unused, many_single_char_names)]
5+
#[allow(unused, clippy::many_single_char_names)]
66
fn main() {
77
let a: bool = unimplemented!();
88
let b: bool = unimplemented!();
@@ -23,7 +23,7 @@ fn main() {
2323
let _ = !(!a && b);
2424
}
2525

26-
#[allow(unused, many_single_char_names)]
26+
#[allow(unused, clippy::many_single_char_names)]
2727
fn equality_stuff() {
2828
let a: i32 = unimplemented!();
2929
let b: i32 = unimplemented!();
@@ -39,7 +39,7 @@ fn equality_stuff() {
3939
let _ = a != b || !(a != b || c == d);
4040
}
4141

42-
#[allow(unused, many_single_char_names)]
42+
#[allow(unused, clippy::many_single_char_names)]
4343
fn methods_with_negation() {
4444
let a: Option<i32> = unimplemented!();
4545
let b: Result<i32, i32> = unimplemented!();
@@ -59,7 +59,7 @@ fn methods_with_negation() {
5959
}
6060

6161
// Simplified versions of https://github.com/rust-lang-nursery/rust-clippy/issues/2638
62-
// nonminimal_bool should only check the built-in Result and Some type, not
62+
// clippy::nonminimal_bool should only check the built-in Result and Some type, not
6363
// any other types like the following.
6464
enum CustomResultOk<E> { Ok, Err(E) }
6565
enum CustomResultErr<E> { Ok, Err(E) }
@@ -115,7 +115,7 @@ fn warn_for_built_in_methods_with_negation() {
115115
if !res.is_none() { }
116116
}
117117

118-
#[allow(neg_cmp_op_on_partial_ord)]
118+
#[allow(clippy::neg_cmp_op_on_partial_ord)]
119119
fn dont_warn_for_negated_partial_ord_comparison() {
120120
let a: f64 = unimplemented!();
121121
let b: f64 = unimplemented!();

tests/ui/borrow_box.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
#![feature(tool_lints)]
12

23

3-
4-
#![deny(borrowed_box)]
5-
#![allow(blacklisted_name)]
4+
#![deny(clippy::borrowed_box)]
5+
#![allow(clippy::blacklisted_name)]
66
#![allow(unused_variables)]
77
#![allow(dead_code)]
88

tests/ui/box_vec.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
#![feature(tool_lints)]
12

23

3-
4-
#![warn(clippy)]
5-
#![allow(boxed_local, needless_pass_by_value)]
6-
#![allow(blacklisted_name)]
4+
#![warn(clippy::all)]
5+
#![allow(clippy::boxed_local, clippy::needless_pass_by_value)]
6+
#![allow(clippy::blacklisted_name)]
77

88
macro_rules! boxit {
99
($init:expr, $x:ty) => {

tests/ui/builtin-type-shadow.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
#![feature(tool_lints)]
12

2-
3-
#![warn(builtin_type_shadow)]
3+
#![warn(clippy::builtin_type_shadow)]
44

55
fn foo<u32>(a: u32) -> u32 {
66
42

tests/ui/bytecount.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
#![feature(tool_lints)]
12

23

3-
4-
#[deny(naive_bytecount)]
4+
#[deny(clippy::naive_bytecount)]
55
fn main() {
66
let x = vec![0_u8; 16];
77

tests/ui/cast.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
1+
#![feature(tool_lints)]
12

23

3-
4-
#[warn(cast_precision_loss, cast_possible_truncation, cast_sign_loss, cast_possible_wrap, cast_lossless)]
5-
#[allow(no_effect, unnecessary_operation)]
4+
#[warn(clippy::cast_precision_loss, clippy::cast_possible_truncation, clippy::cast_sign_loss, clippy::cast_possible_wrap, clippy::cast_lossless)]
5+
#[allow(clippy::no_effect, clippy::unnecessary_operation)]
66
fn main() {
7-
// Test cast_precision_loss
7+
// Test clippy::cast_precision_loss
88
1i32 as f32;
99
1i64 as f32;
1010
1i64 as f64;
1111
1u32 as f32;
1212
1u64 as f32;
1313
1u64 as f64;
14-
// Test cast_possible_truncation
14+
// Test clippy::cast_possible_truncation
1515
1f32 as i32;
1616
1f32 as u32;
1717
1f64 as f32;
1818
1i32 as i8;
1919
1i32 as u8;
2020
1f64 as isize;
2121
1f64 as usize;
22-
// Test cast_possible_wrap
22+
// Test clippy::cast_possible_wrap
2323
1u8 as i8;
2424
1u16 as i16;
2525
1u32 as i32;
2626
1u64 as i64;
2727
1usize as isize;
28-
// Test cast_lossless with casts from floating-point types
28+
// Test clippy::cast_lossless with casts from floating-point types
2929
1.0f32 as f64;
30-
// Test cast_lossless with an expression wrapped in parens
30+
// Test clippy::cast_lossless with an expression wrapped in parens
3131
(1u8 + 1u8) as u16;
32-
// Test cast_sign_loss
32+
// Test clippy::cast_sign_loss
3333
1i32 as u32;
3434
1isize as usize;
3535
// Extra checks for *size

tests/ui/cast_alignment.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
#![feature(tool_lints)]
2+
13
//! Test casts for alignment issues
24
35
#![feature(libc)]
46

57
extern crate libc;
68

7-
#[warn(cast_ptr_alignment)]
8-
#[allow(no_effect, unnecessary_operation, cast_lossless)]
9+
#[warn(clippy::cast_ptr_alignment)]
10+
#[allow(clippy::no_effect, clippy::unnecessary_operation, clippy::cast_lossless)]
911
fn main() {
1012
/* These should be warned against */
1113

tests/ui/cast_lossless_float.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
#[warn(cast_lossless)]
2-
#[allow(no_effect, unnecessary_operation)]
1+
#![feature(tool_lints)]
2+
3+
#[warn(clippy::cast_lossless)]
4+
#[allow(clippy::no_effect, clippy::unnecessary_operation)]
35
fn main() {
4-
// Test cast_lossless with casts to floating-point types
6+
// Test clippy::cast_lossless with casts to floating-point types
57
1i8 as f32;
68
1i8 as f64;
79
1u8 as f32;

tests/ui/cast_lossless_integer.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
2-
#[warn(cast_lossless)]
3-
#[allow(no_effect, unnecessary_operation)]
1+
#![feature(tool_lints)]
2+
#[warn(clippy::cast_lossless)]
3+
#[allow(clippy::no_effect, clippy::unnecessary_operation)]
44
fn main() {
5-
// Test cast_lossless with casts to integer types
5+
// Test clippy::cast_lossless with casts to integer types
66
1i8 as i16;
77
1i8 as i32;
88
1i8 as i64;

tests/ui/cast_size.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
#[warn(cast_precision_loss, cast_possible_truncation, cast_sign_loss, cast_possible_wrap, cast_lossless)]
2-
#[allow(no_effect, unnecessary_operation)]
1+
#![feature(tool_lints)]
2+
3+
#[warn(clippy::cast_precision_loss, clippy::cast_possible_truncation, clippy::cast_sign_loss, clippy::cast_possible_wrap, clippy::cast_lossless)]
4+
#[allow(clippy::no_effect, clippy::unnecessary_operation)]
35
fn main() {
46
// Casting from *size
57
1isize as i8;

tests/ui/char_lit_as_u8.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
#![feature(tool_lints)]
12

23

3-
4-
#![warn(char_lit_as_u8)]
4+
#![warn(clippy::char_lit_as_u8)]
55
#![allow(unused_variables)]
66
fn main() {
77
let c = 'a' as u8;

tests/ui/checked_unwrap.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
#![deny(panicking_unwrap, unnecessary_unwrap)]
2-
#![allow(if_same_then_else)]
1+
#![feature(tool_lints)]
2+
3+
#![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
4+
#![allow(clippy::if_same_then_else)]
35

46
fn main() {
57
let x = Some(());

tests/ui/clone_on_copy_mut.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
#![feature(tool_lints)]
2+
13
pub fn dec_read_dec(i: &mut i32) -> i32 {
24
*i -= 1;
35
let ret = *i;
46
*i -= 1;
57
ret
68
}
79

8-
#[allow(trivially_copy_pass_by_ref)]
10+
#[allow(clippy::trivially_copy_pass_by_ref)]
911
pub fn minus_1(i: &i32) -> i32 {
1012
dec_read_dec(&mut i.clone())
1113
}

tests/ui/cmp_nan.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
#![feature(tool_lints)]
12

23

3-
4-
#[warn(cmp_nan)]
5-
#[allow(float_cmp, no_effect, unnecessary_operation)]
4+
#[warn(clippy::cmp_nan)]
5+
#[allow(clippy::float_cmp, clippy::no_effect, clippy::unnecessary_operation)]
66
fn main() {
77
let x = 5f32;
88
x == std::f32::NAN;

tests/ui/cmp_null.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
#![feature(tool_lints)]
12

2-
3-
#![warn(cmp_null)]
3+
#![warn(clippy::cmp_null)]
44
#![allow(unused_mut)]
55

66
use std::ptr;

0 commit comments

Comments
 (0)