Skip to content

Commit 3282955

Browse files
committed
Update tests
1 parent a7c0800 commit 3282955

7 files changed

+108
-114
lines changed

tests/ui/block_in_if_condition.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ LL | if { true } {
3131
} ...
3232

3333
error: in an 'if' condition, avoid complex blocks or closures with blocks; instead, move the block or closure higher and bind it with a 'let'
34-
--> $DIR/block_in_if_condition.rs:57:17
34+
--> $DIR/block_in_if_condition.rs:58:17
3535
|
3636
LL | |x| {
3737
| _________________^
@@ -41,7 +41,7 @@ LL | | },
4141
| |_____________^
4242

4343
error: in an 'if' condition, avoid complex blocks or closures with blocks; instead, move the block or closure higher and bind it with a 'let'
44-
--> $DIR/block_in_if_condition.rs:66:13
44+
--> $DIR/block_in_if_condition.rs:67:13
4545
|
4646
LL | |x| {
4747
| _____________^
@@ -51,7 +51,7 @@ LL | | },
5151
| |_________^
5252

5353
error: this boolean expression can be simplified
54-
--> $DIR/block_in_if_condition.rs:76:8
54+
--> $DIR/block_in_if_condition.rs:77:8
5555
|
5656
LL | if true && x == 3 {
5757
| ^^^^^^^^^^^^^^ help: try: `x == 3`

tests/ui/doc.stderr

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
1-
error: you should put `DOC_MARKDOWN` between ticks in the documentation
2-
--> $DIR/doc.rs:1:29
3-
|
4-
LL | //! This file tests for the DOC_MARKDOWN lint
5-
| ^^^^^^^^^^^^
6-
|
7-
= note: `-D clippy::doc-markdown` implied by `-D warnings`
8-
91
error: you should put `foo_bar` between ticks in the documentation
102
--> $DIR/doc.rs:8:9
113
|
124
LL | /// The foo_bar function does _nothing_. See also foo::bar. (note the dot there)
135
| ^^^^^^^
6+
|
7+
= note: `-D clippy::doc-markdown` implied by `-D warnings`
148

159
error: you should put `foo::bar` between ticks in the documentation
1610
--> $DIR/doc.rs:8:51
@@ -19,9 +13,9 @@ LL | /// The foo_bar function does _nothing_. See also foo::bar. (note the dot t
1913
| ^^^^^^^^
2014

2115
error: you should put `Foo::some_fun` between ticks in the documentation
22-
--> $DIR/doc.rs:9:84
16+
--> $DIR/doc.rs:9:83
2317
|
24-
LL | /// Markdown is _weird_. I mean _really weird_. This \_ is ok. So is `_`. But not Foo::some_fun
18+
LL | /// Markdown is _weird_. I mean _really weird_. This /_ is ok. So is `_`. But not Foo::some_fun
2519
| ^^^^^^^^^^^^^
2620

2721
error: you should put `a::global:path` between ticks in the documentation
@@ -115,10 +109,10 @@ LL | /// be_sure_we_got_to_the_end_of_it
115109
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
116110

117111
error: you should put `FooBar` between ticks in the documentation
118-
--> $DIR/doc.rs:110:42
112+
--> $DIR/doc.rs:110:43
119113
|
120-
LL | /** E.g. serialization of an empty list: FooBar
121-
| ^^^^^^
114+
LL | /** E.g., serialization of an empty list: FooBar
115+
| ^^^^^^
122116

123117
error: you should put `BarQuz` between ticks in the documentation
124118
--> $DIR/doc.rs:115:5
@@ -133,10 +127,10 @@ LL | be_sure_we_got_to_the_end_of_it
133127
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
134128

135129
error: you should put `FooBar` between ticks in the documentation
136-
--> $DIR/doc.rs:121:42
130+
--> $DIR/doc.rs:121:43
137131
|
138-
LL | /** E.g. serialization of an empty list: FooBar
139-
| ^^^^^^
132+
LL | /** E.g., serialization of an empty list: FooBar
133+
| ^^^^^^
140134

141135
error: you should put `BarQuz` between ticks in the documentation
142136
--> $DIR/doc.rs:126:5
@@ -186,5 +180,5 @@ error: you should put `mycrate::Collection` between ticks in the documentation
186180
LL | /// An iterator over mycrate::Collection's values.
187181
| ^^^^^^^^^^^^^^^^^^^
188182

189-
error: aborting due to 31 previous errors
183+
error: aborting due to 30 previous errors
190184

tests/ui/format.fixed

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,51 +6,51 @@
66
struct Foo(pub String);
77

88
macro_rules! foo {
9-
($($t:tt)*) => (Foo(format!($($t)*)))
9+
($($t:tt)*) => (Foo(format!($($t)*)))
1010
}
1111

1212
fn main() {
1313
"foo".to_string();
1414

1515
"foo".to_string();
16-
format!("{:?}", "foo"); // don't warn about debug
16+
format!("{:?}", "foo"); // Don't warn about `Debug`.
1717
format!("{:8}", "foo");
1818
format!("{:width$}", "foo", width = 8);
19-
"foo".to_string(); // warn when the format makes no difference
20-
"foo".to_string(); // warn when the format makes no difference
19+
"foo".to_string(); // Warn when the format makes no difference.
20+
"foo".to_string(); // Warn when the format makes no difference.
2121
format!("foo {}", "bar");
2222
format!("{} bar", "foo");
2323

2424
let arg: String = "".to_owned();
2525
arg.to_string();
26-
format!("{:?}", arg); // don't warn about debug
26+
format!("{:?}", arg); // Don't warn about debug.
2727
format!("{:8}", arg);
2828
format!("{:width$}", arg, width = 8);
29-
arg.to_string(); // warn when the format makes no difference
30-
arg.to_string(); // warn when the format makes no difference
29+
arg.to_string(); // Warn when the format makes no difference.
30+
arg.to_string(); // Warn when the format makes no difference.
3131
format!("foo {}", arg);
3232
format!("{} bar", arg);
3333

34-
// we don’t want to warn for non-string args, see #697
34+
// We don’t want to warn for non-string args; see issue #697.
3535
format!("{}", 42);
3636
format!("{:?}", 42);
3737
format!("{:+}", 42);
3838
format!("foo {}", 42);
3939
format!("{} bar", 42);
4040

41-
// we only want to warn about `format!` itself
41+
// We only want to warn about `format!` itself.
4242
println!("foo");
4343
println!("{}", "foo");
4444
println!("foo {}", "foo");
4545
println!("{}", 42);
4646
println!("foo {}", 42);
4747

48-
// A format! inside a macro should not trigger a warning
48+
// A `format!` inside a macro should not trigger a warning.
4949
foo!("should not warn");
5050

51-
// precision on string means slicing without panicking on size:
52-
format!("{:.1}", "foo"); // could be "foo"[..1]
53-
format!("{:.10}", "foo"); // could not be "foo"[..10]
51+
// Precision on string means slicing without panicking on size.
52+
format!("{:.1}", "foo"); // Could be `"foo"[..1]`
53+
format!("{:.10}", "foo"); // Could not be `"foo"[..10]`
5454
format!("{:.prec$}", "foo", prec = 1);
5555
format!("{:.prec$}", "foo", prec = 10);
5656

tests/ui/format.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ LL | format!("{}", "foo");
1515
error: useless use of `format!`
1616
--> $DIR/format.rs:19:5
1717
|
18-
LL | format!("{:+}", "foo"); // warn when the format makes no difference
18+
LL | format!("{:+}", "foo"); // Warn when the format makes no difference.
1919
| ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using .to_string(): `"foo".to_string();`
2020

2121
error: useless use of `format!`
2222
--> $DIR/format.rs:20:5
2323
|
24-
LL | format!("{:<}", "foo"); // warn when the format makes no difference
24+
LL | format!("{:<}", "foo"); // Warn when the format makes no difference.
2525
| ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using .to_string(): `"foo".to_string();`
2626

2727
error: useless use of `format!`
@@ -33,13 +33,13 @@ LL | format!("{}", arg);
3333
error: useless use of `format!`
3434
--> $DIR/format.rs:29:5
3535
|
36-
LL | format!("{:+}", arg); // warn when the format makes no difference
36+
LL | format!("{:+}", arg); // Warn when the format makes no difference.
3737
| ^^^^^^^^^^^^^^^^^^^^^ help: consider using .to_string(): `arg.to_string();`
3838

3939
error: useless use of `format!`
4040
--> $DIR/format.rs:30:5
4141
|
42-
LL | format!("{:<}", arg); // warn when the format makes no difference
42+
LL | format!("{:<}", arg); // Warn when the format makes no difference.
4343
| ^^^^^^^^^^^^^^^^^^^^^ help: consider using .to_string(): `arg.to_string();`
4444

4545
error: useless use of `format!`

tests/ui/len_zero.stderr

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ LL | | }
1919
| |_^
2020

2121
error: item `HasIsEmpty` has a public `len` method but a private `is_empty` method
22-
--> $DIR/len_zero.rs:89:1
22+
--> $DIR/len_zero.rs:90:1
2323
|
2424
LL | / impl HasIsEmpty {
2525
LL | | pub fn len(self: &Self) -> isize {
@@ -31,7 +31,7 @@ LL | | }
3131
| |_^
3232

3333
error: item `HasWrongIsEmpty` has a public `len` method but no corresponding `is_empty` method
34-
--> $DIR/len_zero.rs:118:1
34+
--> $DIR/len_zero.rs:119:1
3535
|
3636
LL | / impl HasWrongIsEmpty {
3737
LL | | pub fn len(self: &Self) -> isize {
@@ -43,93 +43,93 @@ LL | | }
4343
| |_^
4444

4545
error: length comparison to zero
46-
--> $DIR/len_zero.rs:139:8
46+
--> $DIR/len_zero.rs:140:8
4747
|
4848
LL | if x.len() == 0 {
4949
| ^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `x.is_empty()`
5050
|
5151
= note: `-D clippy::len-zero` implied by `-D warnings`
5252

5353
error: length comparison to zero
54-
--> $DIR/len_zero.rs:143:8
54+
--> $DIR/len_zero.rs:144:8
5555
|
5656
LL | if "".len() == 0 {}
5757
| ^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `"".is_empty()`
5858

5959
error: length comparison to zero
60-
--> $DIR/len_zero.rs:158:8
60+
--> $DIR/len_zero.rs:159:8
6161
|
6262
LL | if has_is_empty.len() == 0 {
6363
| ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `has_is_empty.is_empty()`
6464

6565
error: length comparison to zero
66-
--> $DIR/len_zero.rs:161:8
66+
--> $DIR/len_zero.rs:162:8
6767
|
6868
LL | if has_is_empty.len() != 0 {
6969
| ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `!has_is_empty.is_empty()`
7070

7171
error: length comparison to zero
72-
--> $DIR/len_zero.rs:164:8
72+
--> $DIR/len_zero.rs:165:8
7373
|
7474
LL | if has_is_empty.len() > 0 {
7575
| ^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `!has_is_empty.is_empty()`
7676

7777
error: length comparison to one
78-
--> $DIR/len_zero.rs:167:8
78+
--> $DIR/len_zero.rs:168:8
7979
|
8080
LL | if has_is_empty.len() < 1 {
8181
| ^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `has_is_empty.is_empty()`
8282

8383
error: length comparison to one
84-
--> $DIR/len_zero.rs:170:8
84+
--> $DIR/len_zero.rs:171:8
8585
|
8686
LL | if has_is_empty.len() >= 1 {
8787
| ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `!has_is_empty.is_empty()`
8888

8989
error: length comparison to zero
90-
--> $DIR/len_zero.rs:181:8
90+
--> $DIR/len_zero.rs:182:8
9191
|
9292
LL | if 0 == has_is_empty.len() {
9393
| ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `has_is_empty.is_empty()`
9494

9595
error: length comparison to zero
96-
--> $DIR/len_zero.rs:184:8
96+
--> $DIR/len_zero.rs:185:8
9797
|
9898
LL | if 0 != has_is_empty.len() {
9999
| ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `!has_is_empty.is_empty()`
100100

101101
error: length comparison to zero
102-
--> $DIR/len_zero.rs:187:8
102+
--> $DIR/len_zero.rs:188:8
103103
|
104104
LL | if 0 < has_is_empty.len() {
105105
| ^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `!has_is_empty.is_empty()`
106106

107107
error: length comparison to one
108-
--> $DIR/len_zero.rs:190:8
108+
--> $DIR/len_zero.rs:191:8
109109
|
110110
LL | if 1 <= has_is_empty.len() {
111111
| ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `!has_is_empty.is_empty()`
112112

113113
error: length comparison to one
114-
--> $DIR/len_zero.rs:193:8
114+
--> $DIR/len_zero.rs:194:8
115115
|
116116
LL | if 1 > has_is_empty.len() {
117117
| ^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `has_is_empty.is_empty()`
118118

119119
error: length comparison to zero
120-
--> $DIR/len_zero.rs:207:8
120+
--> $DIR/len_zero.rs:208:8
121121
|
122122
LL | if with_is_empty.len() == 0 {
123123
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `with_is_empty.is_empty()`
124124

125125
error: length comparison to zero
126-
--> $DIR/len_zero.rs:220:8
126+
--> $DIR/len_zero.rs:221:8
127127
|
128128
LL | if b.len() != 0 {}
129129
| ^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `!b.is_empty()`
130130

131131
error: trait `DependsOnFoo` has a `len` method but no (possibly inherited) `is_empty` method
132-
--> $DIR/len_zero.rs:226:1
132+
--> $DIR/len_zero.rs:227:1
133133
|
134134
LL | / pub trait DependsOnFoo: Foo {
135135
LL | | fn len(&mut self) -> usize;

0 commit comments

Comments
 (0)