Skip to content

Commit c81cd9a

Browse files
committed
restore tests
1 parent d7784d3 commit c81cd9a

12 files changed

+41
-46
lines changed

clippy_lints/src/same_name_method.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ impl<'tcx> LateLintPass<'tcx> for SameNameMethod {
7878
then{
7979
// FIXME: if
8080
// `rustc_middle::ty::assoc::AssocItems::items` is public,
81-
// we can iterate its keys, which's more efficient
81+
// we can iterate its keys instead of `in_definition_order`,
82+
// which's more efficient
8283
cx.tcx
8384
.associated_items(did)
8485
.in_definition_order()

tests/ui/clone_on_copy.fixed

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
clippy::no_effect,
88
clippy::unnecessary_operation,
99
clippy::vec_init_then_push,
10-
clippy::toplevel_ref_arg,
11-
clippy::same_name_method
10+
clippy::toplevel_ref_arg
1211
)]
1312

1413
use std::cell::RefCell;

tests/ui/clone_on_copy.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
clippy::no_effect,
88
clippy::unnecessary_operation,
99
clippy::vec_init_then_push,
10-
clippy::toplevel_ref_arg,
11-
clippy::same_name_method
10+
clippy::toplevel_ref_arg
1211
)]
1312

1413
use std::cell::RefCell;

tests/ui/clone_on_copy.stderr

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,49 @@
11
error: using `clone` on type `i32` which implements the `Copy` trait
2-
--> $DIR/clone_on_copy.rs:25:5
2+
--> $DIR/clone_on_copy.rs:24:5
33
|
44
LL | 42.clone();
55
| ^^^^^^^^^^ help: try removing the `clone` call: `42`
66
|
77
= note: `-D clippy::clone-on-copy` implied by `-D warnings`
88

99
error: using `clone` on type `i32` which implements the `Copy` trait
10-
--> $DIR/clone_on_copy.rs:29:5
10+
--> $DIR/clone_on_copy.rs:28:5
1111
|
1212
LL | (&42).clone();
1313
| ^^^^^^^^^^^^^ help: try dereferencing it: `*(&42)`
1414

1515
error: using `clone` on type `i32` which implements the `Copy` trait
16-
--> $DIR/clone_on_copy.rs:32:5
16+
--> $DIR/clone_on_copy.rs:31:5
1717
|
1818
LL | rc.borrow().clone();
1919
| ^^^^^^^^^^^^^^^^^^^ help: try dereferencing it: `*rc.borrow()`
2020

2121
error: using `clone` on type `u32` which implements the `Copy` trait
22-
--> $DIR/clone_on_copy.rs:35:5
22+
--> $DIR/clone_on_copy.rs:34:5
2323
|
2424
LL | x.clone().rotate_left(1);
2525
| ^^^^^^^^^ help: try removing the `clone` call: `x`
2626

2727
error: using `clone` on type `i32` which implements the `Copy` trait
28-
--> $DIR/clone_on_copy.rs:49:5
28+
--> $DIR/clone_on_copy.rs:48:5
2929
|
3030
LL | m!(42).clone();
3131
| ^^^^^^^^^^^^^^ help: try removing the `clone` call: `m!(42)`
3232

3333
error: using `clone` on type `[u32; 2]` which implements the `Copy` trait
34-
--> $DIR/clone_on_copy.rs:59:5
34+
--> $DIR/clone_on_copy.rs:58:5
3535
|
3636
LL | x.clone()[0];
3737
| ^^^^^^^^^ help: try dereferencing it: `(*x)`
3838

3939
error: using `clone` on type `char` which implements the `Copy` trait
40-
--> $DIR/clone_on_copy.rs:69:14
40+
--> $DIR/clone_on_copy.rs:68:14
4141
|
4242
LL | is_ascii('z'.clone());
4343
| ^^^^^^^^^^^ help: try removing the `clone` call: `'z'`
4444

4545
error: using `clone` on type `i32` which implements the `Copy` trait
46-
--> $DIR/clone_on_copy.rs:73:14
46+
--> $DIR/clone_on_copy.rs:72:14
4747
|
4848
LL | vec.push(42.clone());
4949
| ^^^^^^^^^^ help: try removing the `clone` call: `42`

tests/ui/len_without_is_empty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// edition:2018
22

33
#![warn(clippy::len_without_is_empty)]
4-
#![allow(dead_code, unused, clippy::same_name_method)]
4+
#![allow(dead_code, unused)]
55

66
pub struct PubOne;
77

tests/ui/or_fun_call.fixed

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#![warn(clippy::or_fun_call)]
44
#![allow(dead_code)]
55
#![allow(clippy::unnecessary_wraps)]
6-
#![allow(clippy::same_name_method)]
76

87
use std::collections::BTreeMap;
98
use std::collections::HashMap;

tests/ui/or_fun_call.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#![warn(clippy::or_fun_call)]
44
#![allow(dead_code)]
55
#![allow(clippy::unnecessary_wraps)]
6-
#![allow(clippy::same_name_method)]
76

87
use std::collections::BTreeMap;
98
use std::collections::HashMap;

tests/ui/or_fun_call.stderr

+24-24
Original file line numberDiff line numberDiff line change
@@ -1,145 +1,145 @@
11
error: use of `unwrap_or` followed by a function call
2-
--> $DIR/or_fun_call.rs:47:19
2+
--> $DIR/or_fun_call.rs:46:19
33
|
44
LL | with_const_fn.unwrap_or(Duration::from_secs(5));
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| Duration::from_secs(5))`
66
|
77
= note: `-D clippy::or-fun-call` implied by `-D warnings`
88

99
error: use of `unwrap_or` followed by a function call
10-
--> $DIR/or_fun_call.rs:50:22
10+
--> $DIR/or_fun_call.rs:49:22
1111
|
1212
LL | with_constructor.unwrap_or(make());
1313
| ^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(make)`
1414

1515
error: use of `unwrap_or` followed by a call to `new`
16-
--> $DIR/or_fun_call.rs:53:5
16+
--> $DIR/or_fun_call.rs:52:5
1717
|
1818
LL | with_new.unwrap_or(Vec::new());
1919
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_new.unwrap_or_default()`
2020

2121
error: use of `unwrap_or` followed by a function call
22-
--> $DIR/or_fun_call.rs:56:21
22+
--> $DIR/or_fun_call.rs:55:21
2323
|
2424
LL | with_const_args.unwrap_or(Vec::with_capacity(12));
2525
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| Vec::with_capacity(12))`
2626

2727
error: use of `unwrap_or` followed by a function call
28-
--> $DIR/or_fun_call.rs:59:14
28+
--> $DIR/or_fun_call.rs:58:14
2929
|
3030
LL | with_err.unwrap_or(make());
3131
| ^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|_| make())`
3232

3333
error: use of `unwrap_or` followed by a function call
34-
--> $DIR/or_fun_call.rs:62:19
34+
--> $DIR/or_fun_call.rs:61:19
3535
|
3636
LL | with_err_args.unwrap_or(Vec::with_capacity(12));
3737
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|_| Vec::with_capacity(12))`
3838

3939
error: use of `unwrap_or` followed by a call to `default`
40-
--> $DIR/or_fun_call.rs:65:5
40+
--> $DIR/or_fun_call.rs:64:5
4141
|
4242
LL | with_default_trait.unwrap_or(Default::default());
4343
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_default_trait.unwrap_or_default()`
4444

4545
error: use of `unwrap_or` followed by a call to `default`
46-
--> $DIR/or_fun_call.rs:68:5
46+
--> $DIR/or_fun_call.rs:67:5
4747
|
4848
LL | with_default_type.unwrap_or(u64::default());
4949
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_default_type.unwrap_or_default()`
5050

5151
error: use of `unwrap_or` followed by a function call
52-
--> $DIR/or_fun_call.rs:71:18
52+
--> $DIR/or_fun_call.rs:70:18
5353
|
5454
LL | self_default.unwrap_or(<FakeDefault>::default());
5555
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(<FakeDefault>::default)`
5656

5757
error: use of `unwrap_or` followed by a call to `default`
58-
--> $DIR/or_fun_call.rs:74:5
58+
--> $DIR/or_fun_call.rs:73:5
5959
|
6060
LL | real_default.unwrap_or(<FakeDefault as Default>::default());
6161
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `real_default.unwrap_or_default()`
6262

6363
error: use of `unwrap_or` followed by a call to `new`
64-
--> $DIR/or_fun_call.rs:77:5
64+
--> $DIR/or_fun_call.rs:76:5
6565
|
6666
LL | with_vec.unwrap_or(vec![]);
6767
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_vec.unwrap_or_default()`
6868

6969
error: use of `unwrap_or` followed by a function call
70-
--> $DIR/or_fun_call.rs:80:21
70+
--> $DIR/or_fun_call.rs:79:21
7171
|
7272
LL | without_default.unwrap_or(Foo::new());
7373
| ^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(Foo::new)`
7474

7575
error: use of `or_insert` followed by a function call
76-
--> $DIR/or_fun_call.rs:83:19
76+
--> $DIR/or_fun_call.rs:82:19
7777
|
7878
LL | map.entry(42).or_insert(String::new());
7979
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `or_insert_with(String::new)`
8080

8181
error: use of `or_insert` followed by a function call
82-
--> $DIR/or_fun_call.rs:86:23
82+
--> $DIR/or_fun_call.rs:85:23
8383
|
8484
LL | map_vec.entry(42).or_insert(vec![]);
8585
| ^^^^^^^^^^^^^^^^^ help: try this: `or_insert_with(Vec::new)`
8686

8787
error: use of `or_insert` followed by a function call
88-
--> $DIR/or_fun_call.rs:89:21
88+
--> $DIR/or_fun_call.rs:88:21
8989
|
9090
LL | btree.entry(42).or_insert(String::new());
9191
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `or_insert_with(String::new)`
9292

9393
error: use of `or_insert` followed by a function call
94-
--> $DIR/or_fun_call.rs:92:25
94+
--> $DIR/or_fun_call.rs:91:25
9595
|
9696
LL | btree_vec.entry(42).or_insert(vec![]);
9797
| ^^^^^^^^^^^^^^^^^ help: try this: `or_insert_with(Vec::new)`
9898

9999
error: use of `unwrap_or` followed by a function call
100-
--> $DIR/or_fun_call.rs:95:21
100+
--> $DIR/or_fun_call.rs:94:21
101101
|
102102
LL | let _ = stringy.unwrap_or("".to_owned());
103103
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| "".to_owned())`
104104

105105
error: use of `unwrap_or` followed by a function call
106-
--> $DIR/or_fun_call.rs:103:21
106+
--> $DIR/or_fun_call.rs:102:21
107107
|
108108
LL | let _ = Some(1).unwrap_or(map[&1]);
109109
| ^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| map[&1])`
110110

111111
error: use of `unwrap_or` followed by a function call
112-
--> $DIR/or_fun_call.rs:105:21
112+
--> $DIR/or_fun_call.rs:104:21
113113
|
114114
LL | let _ = Some(1).unwrap_or(map[&1]);
115115
| ^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| map[&1])`
116116

117117
error: use of `or` followed by a function call
118-
--> $DIR/or_fun_call.rs:129:35
118+
--> $DIR/or_fun_call.rs:128:35
119119
|
120120
LL | let _ = Some("a".to_string()).or(Some("b".to_string()));
121121
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `or_else(|| Some("b".to_string()))`
122122

123123
error: use of `or` followed by a function call
124-
--> $DIR/or_fun_call.rs:133:10
124+
--> $DIR/or_fun_call.rs:132:10
125125
|
126126
LL | .or(Some(Bar(b, Duration::from_secs(2))));
127127
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `or_else(|| Some(Bar(b, Duration::from_secs(2))))`
128128

129129
error: use of `unwrap_or` followed by a function call
130-
--> $DIR/or_fun_call.rs:161:14
130+
--> $DIR/or_fun_call.rs:160:14
131131
|
132132
LL | None.unwrap_or(s.as_mut_vec());
133133
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| s.as_mut_vec())`
134134

135135
error: use of `unwrap_or` followed by a function call
136-
--> $DIR/or_fun_call.rs:166:14
136+
--> $DIR/or_fun_call.rs:165:14
137137
|
138138
LL | None.unwrap_or(unsafe { s.as_mut_vec() });
139139
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| unsafe { s.as_mut_vec() })`
140140

141141
error: use of `unwrap_or` followed by a function call
142-
--> $DIR/or_fun_call.rs:168:14
142+
--> $DIR/or_fun_call.rs:167:14
143143
|
144144
LL | None.unwrap_or( unsafe { s.as_mut_vec() } );
145145
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| unsafe { s.as_mut_vec() })`

tests/ui/to_string_in_display.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![warn(clippy::to_string_in_display)]
2-
#![allow(clippy::inherent_to_string_shadow_display, clippy::same_name_method)]
2+
#![allow(clippy::inherent_to_string_shadow_display)]
33

44
use std::fmt;
55

tests/ui/unwrap_or_else_default.fixed

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#![warn(clippy::unwrap_or_else_default)]
44
#![allow(dead_code)]
55
#![allow(clippy::unnecessary_wraps)]
6-
#![allow(clippy::same_name_method)]
76

87
/// Checks implementation of the `UNWRAP_OR_ELSE_DEFAULT` lint.
98
fn unwrap_or_else_default() {

tests/ui/unwrap_or_else_default.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#![warn(clippy::unwrap_or_else_default)]
44
#![allow(dead_code)]
55
#![allow(clippy::unnecessary_wraps)]
6-
#![allow(clippy::same_name_method)]
76

87
/// Checks implementation of the `UNWRAP_OR_ELSE_DEFAULT` lint.
98
fn unwrap_or_else_default() {

tests/ui/unwrap_or_else_default.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
error: use of `.unwrap_or_else(..)` to construct default value
2-
--> $DIR/unwrap_or_else_default.rs:63:5
2+
--> $DIR/unwrap_or_else_default.rs:62:5
33
|
44
LL | with_real_default.unwrap_or_else(<HasDefaultAndDuplicate as Default>::default);
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `with_real_default.unwrap_or_default()`
66
|
77
= note: `-D clippy::unwrap-or-else-default` implied by `-D warnings`
88

99
error: use of `.unwrap_or_else(..)` to construct default value
10-
--> $DIR/unwrap_or_else_default.rs:66:5
10+
--> $DIR/unwrap_or_else_default.rs:65:5
1111
|
1212
LL | with_default_trait.unwrap_or_else(Default::default);
1313
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `with_default_trait.unwrap_or_default()`
1414

1515
error: use of `.unwrap_or_else(..)` to construct default value
16-
--> $DIR/unwrap_or_else_default.rs:69:5
16+
--> $DIR/unwrap_or_else_default.rs:68:5
1717
|
1818
LL | with_default_type.unwrap_or_else(u64::default);
1919
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `with_default_type.unwrap_or_default()`

0 commit comments

Comments
 (0)