Skip to content

Commit dd0f5e5

Browse files
committed
Unused result warning: "X which must" ↦ "X that must"
1 parent 423d810 commit dd0f5e5

File tree

7 files changed

+47
-47
lines changed

7 files changed

+47
-47
lines changed

src/doc/rustc/src/lints/listing/warn-by-default.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ warning: functions generic over types must be mangled
279279
1 | #[no_mangle]
280280
| ------------ help: remove this attribute
281281
2 | / fn foo<T>(t: T) {
282-
3 | |
282+
3 | |
283283
4 | | }
284284
| |_^
285285
|
@@ -513,7 +513,7 @@ This will produce:
513513
warning: borrow of packed field requires unsafe function or block (error E0133)
514514
--> src/main.rs:11:13
515515
|
516-
11 | let y = &x.data.0;
516+
11 | let y = &x.data.0;
517517
| ^^^^^^^^^
518518
|
519519
= note: #[warn(safe_packed_borrows)] on by default
@@ -874,7 +874,7 @@ fn main() {
874874
This will produce:
875875

876876
```text
877-
warning: unused `std::result::Result` which must be used
877+
warning: unused `std::result::Result` that must be used
878878
--> src/main.rs:6:5
879879
|
880880
6 | returns_result();

src/libcore/iter/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@
253253
//! using it. The compiler will warn us about this kind of behavior:
254254
//!
255255
//! ```text
256-
//! warning: unused result which must be used: iterator adaptors are lazy and
256+
//! warning: unused result that must be used: iterator adaptors are lazy and
257257
//! do nothing unless consumed
258258
//! ```
259259
//!

src/librustc_lint/unused.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedResults {
135135

136136
if let Some(must_use_op) = must_use_op {
137137
cx.span_lint(UNUSED_MUST_USE, expr.span,
138-
&format!("unused {} which must be used", must_use_op));
138+
&format!("unused {} that must be used", must_use_op));
139139
op_warned = true;
140140
}
141141

@@ -146,7 +146,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedResults {
146146
fn check_must_use(cx: &LateContext, def_id: DefId, sp: Span, describe_path: &str) -> bool {
147147
for attr in cx.tcx.get_attrs(def_id).iter() {
148148
if attr.check_name("must_use") {
149-
let msg = format!("unused {}`{}` which must be used",
149+
let msg = format!("unused {}`{}` that must be used",
150150
describe_path, cx.tcx.item_path_str(def_id));
151151
let mut err = cx.struct_span_lint(UNUSED_MUST_USE, sp, &msg);
152152
// check for #[must_use = "..."]
@@ -233,7 +233,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedAttributes {
233233
.find(|&&(builtin, ty, _)| name == builtin && ty == AttributeType::CrateLevel)
234234
.is_some();
235235

236-
// Has a plugin registered this attribute as one which must be used at
236+
// Has a plugin registered this attribute as one that must be used at
237237
// the crate level?
238238
let plugin_crate = plugin_attributes.iter()
239239
.find(|&&(ref x, t)| name == &**x && AttributeType::CrateLevel == t)

src/test/ui/fn_must_use.stderr

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
warning: unused return value of `need_to_use_this_value` which must be used
1+
warning: unused return value of `need_to_use_this_value` that must be used
22
--> $DIR/fn_must_use.rs:60:5
33
|
44
LL | need_to_use_this_value(); //~ WARN unused return value
@@ -11,39 +11,39 @@ LL | #![warn(unused_must_use)]
1111
| ^^^^^^^^^^^^^^^
1212
= note: it's important
1313

14-
warning: unused return value of `MyStruct::need_to_use_this_method_value` which must be used
14+
warning: unused return value of `MyStruct::need_to_use_this_method_value` that must be used
1515
--> $DIR/fn_must_use.rs:65:5
1616
|
1717
LL | m.need_to_use_this_method_value(); //~ WARN unused return value
1818
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1919

20-
warning: unused return value of `EvenNature::is_even` which must be used
20+
warning: unused return value of `EvenNature::is_even` that must be used
2121
--> $DIR/fn_must_use.rs:66:5
2222
|
2323
LL | m.is_even(); // trait method!
2424
| ^^^^^^^^^^^^
2525
|
2626
= note: no side effects
2727

28-
warning: unused return value of `std::cmp::PartialEq::eq` which must be used
28+
warning: unused return value of `std::cmp::PartialEq::eq` that must be used
2929
--> $DIR/fn_must_use.rs:72:5
3030
|
3131
LL | 2.eq(&3); //~ WARN unused return value
3232
| ^^^^^^^^^
3333

34-
warning: unused return value of `std::cmp::PartialEq::eq` which must be used
34+
warning: unused return value of `std::cmp::PartialEq::eq` that must be used
3535
--> $DIR/fn_must_use.rs:73:5
3636
|
3737
LL | m.eq(&n); //~ WARN unused return value
3838
| ^^^^^^^^^
3939

40-
warning: unused comparison which must be used
40+
warning: unused comparison that must be used
4141
--> $DIR/fn_must_use.rs:76:5
4242
|
4343
LL | 2 == 3; //~ WARN unused comparison
4444
| ^^^^^^
4545

46-
warning: unused comparison which must be used
46+
warning: unused comparison that must be used
4747
--> $DIR/fn_must_use.rs:77:5
4848
|
4949
LL | m == n; //~ WARN unused comparison

src/test/ui/lint/must-use-ops.stderr

+21-21
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
warning: unused comparison which must be used
1+
warning: unused comparison that must be used
22
--> $DIR/must-use-ops.rs:22:5
33
|
44
LL | val == 1;
@@ -10,121 +10,121 @@ note: lint level defined here
1010
LL | #![warn(unused_must_use)]
1111
| ^^^^^^^^^^^^^^^
1212

13-
warning: unused comparison which must be used
13+
warning: unused comparison that must be used
1414
--> $DIR/must-use-ops.rs:23:5
1515
|
1616
LL | val < 1;
1717
| ^^^^^^^
1818

19-
warning: unused comparison which must be used
19+
warning: unused comparison that must be used
2020
--> $DIR/must-use-ops.rs:24:5
2121
|
2222
LL | val <= 1;
2323
| ^^^^^^^^
2424

25-
warning: unused comparison which must be used
25+
warning: unused comparison that must be used
2626
--> $DIR/must-use-ops.rs:25:5
2727
|
2828
LL | val != 1;
2929
| ^^^^^^^^
3030

31-
warning: unused comparison which must be used
31+
warning: unused comparison that must be used
3232
--> $DIR/must-use-ops.rs:26:5
3333
|
3434
LL | val >= 1;
3535
| ^^^^^^^^
3636

37-
warning: unused comparison which must be used
37+
warning: unused comparison that must be used
3838
--> $DIR/must-use-ops.rs:27:5
3939
|
4040
LL | val > 1;
4141
| ^^^^^^^
4242

43-
warning: unused arithmetic operation which must be used
43+
warning: unused arithmetic operation that must be used
4444
--> $DIR/must-use-ops.rs:30:5
4545
|
4646
LL | val + 2;
4747
| ^^^^^^^
4848

49-
warning: unused arithmetic operation which must be used
49+
warning: unused arithmetic operation that must be used
5050
--> $DIR/must-use-ops.rs:31:5
5151
|
5252
LL | val - 2;
5353
| ^^^^^^^
5454

55-
warning: unused arithmetic operation which must be used
55+
warning: unused arithmetic operation that must be used
5656
--> $DIR/must-use-ops.rs:32:5
5757
|
5858
LL | val / 2;
5959
| ^^^^^^^
6060

61-
warning: unused arithmetic operation which must be used
61+
warning: unused arithmetic operation that must be used
6262
--> $DIR/must-use-ops.rs:33:5
6363
|
6464
LL | val * 2;
6565
| ^^^^^^^
6666

67-
warning: unused arithmetic operation which must be used
67+
warning: unused arithmetic operation that must be used
6868
--> $DIR/must-use-ops.rs:34:5
6969
|
7070
LL | val % 2;
7171
| ^^^^^^^
7272

73-
warning: unused logical operation which must be used
73+
warning: unused logical operation that must be used
7474
--> $DIR/must-use-ops.rs:37:5
7575
|
7676
LL | true && true;
7777
| ^^^^^^^^^^^^
7878

79-
warning: unused logical operation which must be used
79+
warning: unused logical operation that must be used
8080
--> $DIR/must-use-ops.rs:38:5
8181
|
8282
LL | false || true;
8383
| ^^^^^^^^^^^^^
8484

85-
warning: unused bitwise operation which must be used
85+
warning: unused bitwise operation that must be used
8686
--> $DIR/must-use-ops.rs:41:5
8787
|
8888
LL | 5 ^ val;
8989
| ^^^^^^^
9090

91-
warning: unused bitwise operation which must be used
91+
warning: unused bitwise operation that must be used
9292
--> $DIR/must-use-ops.rs:42:5
9393
|
9494
LL | 5 & val;
9595
| ^^^^^^^
9696

97-
warning: unused bitwise operation which must be used
97+
warning: unused bitwise operation that must be used
9898
--> $DIR/must-use-ops.rs:43:5
9999
|
100100
LL | 5 | val;
101101
| ^^^^^^^
102102

103-
warning: unused bitwise operation which must be used
103+
warning: unused bitwise operation that must be used
104104
--> $DIR/must-use-ops.rs:44:5
105105
|
106106
LL | 5 << val;
107107
| ^^^^^^^^
108108

109-
warning: unused bitwise operation which must be used
109+
warning: unused bitwise operation that must be used
110110
--> $DIR/must-use-ops.rs:45:5
111111
|
112112
LL | 5 >> val;
113113
| ^^^^^^^^
114114

115-
warning: unused unary operation which must be used
115+
warning: unused unary operation that must be used
116116
--> $DIR/must-use-ops.rs:48:5
117117
|
118118
LL | !val;
119119
| ^^^^
120120

121-
warning: unused unary operation which must be used
121+
warning: unused unary operation that must be used
122122
--> $DIR/must-use-ops.rs:49:5
123123
|
124124
LL | -val;
125125
| ^^^^
126126

127-
warning: unused unary operation which must be used
127+
warning: unused unary operation that must be used
128128
--> $DIR/must-use-ops.rs:50:5
129129
|
130130
LL | *val_pointer;

src/test/ui/unused/unused-result.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ fn qux() -> MustUseMsg { return foo::<MustUseMsg>(); }
2828
#[allow(unused_results)]
2929
fn test() {
3030
foo::<isize>();
31-
foo::<MustUse>(); //~ ERROR: unused `MustUse` which must be used
32-
foo::<MustUseMsg>(); //~ ERROR: unused `MustUseMsg` which must be used
31+
foo::<MustUse>(); //~ ERROR: unused `MustUse` that must be used
32+
foo::<MustUseMsg>(); //~ ERROR: unused `MustUseMsg` that must be used
3333
//~^ NOTE: some message
3434
}
3535

@@ -42,8 +42,8 @@ fn test2() {
4242

4343
fn main() {
4444
foo::<isize>(); //~ ERROR: unused result
45-
foo::<MustUse>(); //~ ERROR: unused `MustUse` which must be used
46-
foo::<MustUseMsg>(); //~ ERROR: unused `MustUseMsg` which must be used
45+
foo::<MustUse>(); //~ ERROR: unused `MustUse` that must be used
46+
foo::<MustUseMsg>(); //~ ERROR: unused `MustUseMsg` that must be used
4747
//~^ NOTE: some message
4848

4949
let _ = foo::<isize>();

src/test/ui/unused/unused-result.stderr

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
error: unused `MustUse` which must be used
1+
error: unused `MustUse` that must be used
22
--> $DIR/unused-result.rs:31:5
33
|
4-
LL | foo::<MustUse>(); //~ ERROR: unused `MustUse` which must be used
4+
LL | foo::<MustUse>(); //~ ERROR: unused `MustUse` that must be used
55
| ^^^^^^^^^^^^^^^^^
66
|
77
note: lint level defined here
@@ -10,10 +10,10 @@ note: lint level defined here
1010
LL | #![deny(unused_results, unused_must_use)]
1111
| ^^^^^^^^^^^^^^^
1212

13-
error: unused `MustUseMsg` which must be used
13+
error: unused `MustUseMsg` that must be used
1414
--> $DIR/unused-result.rs:32:5
1515
|
16-
LL | foo::<MustUseMsg>(); //~ ERROR: unused `MustUseMsg` which must be used
16+
LL | foo::<MustUseMsg>(); //~ ERROR: unused `MustUseMsg` that must be used
1717
| ^^^^^^^^^^^^^^^^^^^^
1818
|
1919
= note: some message
@@ -30,16 +30,16 @@ note: lint level defined here
3030
LL | #![deny(unused_results, unused_must_use)]
3131
| ^^^^^^^^^^^^^^
3232

33-
error: unused `MustUse` which must be used
33+
error: unused `MustUse` that must be used
3434
--> $DIR/unused-result.rs:45:5
3535
|
36-
LL | foo::<MustUse>(); //~ ERROR: unused `MustUse` which must be used
36+
LL | foo::<MustUse>(); //~ ERROR: unused `MustUse` that must be used
3737
| ^^^^^^^^^^^^^^^^^
3838

39-
error: unused `MustUseMsg` which must be used
39+
error: unused `MustUseMsg` that must be used
4040
--> $DIR/unused-result.rs:46:5
4141
|
42-
LL | foo::<MustUseMsg>(); //~ ERROR: unused `MustUseMsg` which must be used
42+
LL | foo::<MustUseMsg>(); //~ ERROR: unused `MustUseMsg` that must be used
4343
| ^^^^^^^^^^^^^^^^^^^^
4444
|
4545
= note: some message

0 commit comments

Comments
 (0)