Skip to content

Commit c73cf9f

Browse files
committed
Auto merge of #5893 - matthiaskrgr:lint_msg, r=yaahc
fix remaining lint messages r? @yaahc changelog: make remaining lint messages adhere to rustc dev guide lint message convention.
2 parents 2f4de2f + be3e695 commit c73cf9f

26 files changed

+122
-122
lines changed

clippy_lints/src/duration_subsec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ impl<'tcx> LateLintPass<'tcx> for DurationSubsec {
5656
cx,
5757
DURATION_SUBSEC,
5858
expr.span,
59-
&format!("Calling `{}()` is more concise than this calculation", suggested_fn),
59+
&format!("calling `{}()` is more concise than this calculation", suggested_fn),
6060
"try",
6161
format!(
6262
"{}.{}()",

clippy_lints/src/enum_clike.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ impl<'tcx> LateLintPass<'tcx> for UnportableVariant {
7272
cx,
7373
ENUM_CLIKE_UNPORTABLE_VARIANT,
7474
var.span,
75-
"Clike enum variant discriminant is not portable to 32-bit targets",
75+
"C-like enum variant discriminant is not portable to 32-bit targets",
7676
);
7777
};
7878
}

clippy_lints/src/enum_variants.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,10 @@ fn check_variant(
183183
&& name.chars().nth(item_name_chars).map_or(false, |c| !c.is_lowercase())
184184
&& name.chars().nth(item_name_chars + 1).map_or(false, |c| !c.is_numeric())
185185
{
186-
span_lint(cx, lint, var.span, "Variant name starts with the enum's name");
186+
span_lint(cx, lint, var.span, "variant name starts with the enum's name");
187187
}
188188
if partial_rmatch(item_name, &name) == item_name_chars {
189-
span_lint(cx, lint, var.span, "Variant name ends with the enum's name");
189+
span_lint(cx, lint, var.span, "variant name ends with the enum's name");
190190
}
191191
}
192192
let first = &def.variants[0].ident.name.as_str();
@@ -227,7 +227,7 @@ fn check_variant(
227227
cx,
228228
lint,
229229
span,
230-
&format!("All variants have the same {}fix: `{}`", what, value),
230+
&format!("all variants have the same {}fix: `{}`", what, value),
231231
None,
232232
&format!(
233233
"remove the {}fixes and use full paths to \

clippy_lints/src/if_let_some_result.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ impl<'tcx> LateLintPass<'tcx> for OkIfLet {
6161
cx,
6262
IF_LET_SOME_RESULT,
6363
expr.span.with_hi(op.span.hi()),
64-
"Matching on `Some` with `ok()` is redundant",
65-
&format!("Consider matching on `Ok({})` and removing the call to `ok` instead", some_expr_string),
64+
"matching on `Some` with `ok()` is redundant",
65+
&format!("consider matching on `Ok({})` and removing the call to `ok` instead", some_expr_string),
6666
sugg,
6767
applicability,
6868
);

clippy_lints/src/if_not_else.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ impl EarlyLintPass for IfNotElse {
6060
cx,
6161
IF_NOT_ELSE,
6262
item.span,
63-
"Unnecessary boolean `not` operation",
63+
"unnecessary boolean `not` operation",
6464
None,
6565
"remove the `!` and swap the blocks of the `if`/`else`",
6666
);
@@ -70,7 +70,7 @@ impl EarlyLintPass for IfNotElse {
7070
cx,
7171
IF_NOT_ELSE,
7272
item.span,
73-
"Unnecessary `!=` operation",
73+
"unnecessary `!=` operation",
7474
None,
7575
"change to `==` and swap the blocks of the `if`/`else`",
7676
);

clippy_lints/src/implicit_saturating_sub.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,9 @@ fn print_lint_and_sugg(cx: &LateContext<'_>, var_name: &str, expr: &Expr<'_>) {
158158
cx,
159159
IMPLICIT_SATURATING_SUB,
160160
expr.span,
161-
"Implicitly performing saturating subtraction",
161+
"implicitly performing saturating subtraction",
162162
"try",
163-
format!("{} = {}.saturating_sub({});", var_name, var_name, 1.to_string()),
163+
format!("{} = {}.saturating_sub({});", var_name, var_name, '1'),
164164
Applicability::MachineApplicable,
165165
);
166166
}

clippy_lints/src/inherent_impl.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ impl<'tcx> LateLintPass<'tcx> for MultipleInherentImpl {
8181
cx,
8282
MULTIPLE_INHERENT_IMPL,
8383
*additional_span,
84-
"Multiple implementations of this structure",
84+
"multiple implementations of this structure",
8585
|diag| {
86-
diag.span_note(*initial_span, "First implementation here");
86+
diag.span_note(*initial_span, "first implementation here");
8787
},
8888
)
8989
})

clippy_lints/src/int_plus_one.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ impl IntPlusOne {
152152
cx,
153153
INT_PLUS_ONE,
154154
block.span,
155-
"Unnecessary `>= y + 1` or `x - 1 >=`",
155+
"unnecessary `>= y + 1` or `x - 1 >=`",
156156
"change it to",
157157
recommendation,
158158
Applicability::MachineApplicable, // snippet
@@ -163,8 +163,8 @@ impl IntPlusOne {
163163
impl EarlyLintPass for IntPlusOne {
164164
fn check_expr(&mut self, cx: &EarlyContext<'_>, item: &Expr) {
165165
if let ExprKind::Binary(ref kind, ref lhs, ref rhs) = item.kind {
166-
if let Some(ref rec) = Self::check_binop(cx, kind.node, lhs, rhs) {
167-
Self::emit_warning(cx, item, rec.clone());
166+
if let Some(rec) = Self::check_binop(cx, kind.node, lhs, rhs) {
167+
Self::emit_warning(cx, item, rec);
168168
}
169169
}
170170
}

clippy_lints/src/map_clone.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ fn lint_needless_cloning(cx: &LateContext<'_>, root: Span, receiver: Span) {
111111
cx,
112112
MAP_CLONE,
113113
root.trim_start(receiver).unwrap(),
114-
"You are needlessly cloning iterator elements",
115-
"Remove the `map` call",
114+
"you are needlessly cloning iterator elements",
115+
"remove the `map` call",
116116
String::new(),
117117
Applicability::MachineApplicable,
118118
)
@@ -125,8 +125,8 @@ fn lint(cx: &LateContext<'_>, replace: Span, root: Span, copied: bool) {
125125
cx,
126126
MAP_CLONE,
127127
replace,
128-
"You are using an explicit closure for copying elements",
129-
"Consider calling the dedicated `copied` method",
128+
"you are using an explicit closure for copying elements",
129+
"consider calling the dedicated `copied` method",
130130
format!(
131131
"{}.copied()",
132132
snippet_with_applicability(cx, root, "..", &mut applicability)
@@ -138,8 +138,8 @@ fn lint(cx: &LateContext<'_>, replace: Span, root: Span, copied: bool) {
138138
cx,
139139
MAP_CLONE,
140140
replace,
141-
"You are using an explicit closure for cloning elements",
142-
"Consider calling the dedicated `cloned` method",
141+
"you are using an explicit closure for cloning elements",
142+
"consider calling the dedicated `cloned` method",
143143
format!(
144144
"{}.cloned()",
145145
snippet_with_applicability(cx, root, "..", &mut applicability)

clippy_lints/src/methods/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2280,7 +2280,7 @@ fn lint_iter_next<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'_>, iter_
22802280
cx,
22812281
ITER_NEXT_SLICE,
22822282
expr.span,
2283-
"Using `.iter().next()` on a Slice without end index.",
2283+
"using `.iter().next()` on a Slice without end index",
22842284
"try calling",
22852285
format!("{}.get({})", snippet_with_applicability(cx, caller_var.span, "..", &mut applicability), start_idx),
22862286
applicability,
@@ -2299,7 +2299,7 @@ fn lint_iter_next<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'_>, iter_
22992299
cx,
23002300
ITER_NEXT_SLICE,
23012301
expr.span,
2302-
"Using `.iter().next()` on an array",
2302+
"using `.iter().next()` on an array",
23032303
"try calling",
23042304
format!(
23052305
"{}.get(0)",

clippy_lints/src/mutex_atomic.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ impl<'tcx> LateLintPass<'tcx> for Mutex {
7272
let mutex_param = subst.type_at(0);
7373
if let Some(atomic_name) = get_atomic_name(mutex_param) {
7474
let msg = format!(
75-
"Consider using an `{}` instead of a `Mutex` here. If you just want the locking \
76-
behavior and not the internal type, consider using `Mutex<()>`.",
75+
"consider using an `{}` instead of a `Mutex` here; if you just want the locking \
76+
behavior and not the internal type, consider using `Mutex<()>`",
7777
atomic_name
7878
);
7979
match mutex_param.kind {

clippy_lints/src/stable_sort_primitive.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ impl LateLintPass<'_> for StableSortPrimitive {
111111
STABLE_SORT_PRIMITIVE,
112112
expr.span,
113113
format!(
114-
"Use {} instead of {}",
115-
detection.method.unstable_name(),
116-
detection.method.stable_name()
114+
"used {} instead of {}",
115+
detection.method.stable_name(),
116+
detection.method.unstable_name()
117117
)
118118
.as_str(),
119119
"try",

clippy_lints/src/use_self.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ declare_clippy_lint! {
5050
/// ```
5151
pub USE_SELF,
5252
nursery,
53-
"Unnecessary structure name repetition whereas `Self` is applicable"
53+
"unnecessary structure name repetition whereas `Self` is applicable"
5454
}
5555

5656
declare_lint_pass!(UseSelf => [USE_SELF]);

src/lintlist/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2498,7 +2498,7 @@ pub static ref ALL_LINTS: Vec<Lint> = vec![
24982498
Lint {
24992499
name: "use_self",
25002500
group: "nursery",
2501-
desc: "Unnecessary structure name repetition whereas `Self` is applicable",
2501+
desc: "unnecessary structure name repetition whereas `Self` is applicable",
25022502
deprecation: None,
25032503
module: "use_self",
25042504
},

tests/ui/duration_subsec.stderr

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
1-
error: Calling `subsec_millis()` is more concise than this calculation
1+
error: calling `subsec_millis()` is more concise than this calculation
22
--> $DIR/duration_subsec.rs:10:24
33
|
44
LL | let bad_millis_1 = dur.subsec_micros() / 1_000;
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `dur.subsec_millis()`
66
|
77
= note: `-D clippy::duration-subsec` implied by `-D warnings`
88

9-
error: Calling `subsec_millis()` is more concise than this calculation
9+
error: calling `subsec_millis()` is more concise than this calculation
1010
--> $DIR/duration_subsec.rs:11:24
1111
|
1212
LL | let bad_millis_2 = dur.subsec_nanos() / 1_000_000;
1313
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `dur.subsec_millis()`
1414

15-
error: Calling `subsec_micros()` is more concise than this calculation
15+
error: calling `subsec_micros()` is more concise than this calculation
1616
--> $DIR/duration_subsec.rs:16:22
1717
|
1818
LL | let bad_micros = dur.subsec_nanos() / 1_000;
1919
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `dur.subsec_micros()`
2020

21-
error: Calling `subsec_micros()` is more concise than this calculation
21+
error: calling `subsec_micros()` is more concise than this calculation
2222
--> $DIR/duration_subsec.rs:21:13
2323
|
2424
LL | let _ = (&dur).subsec_nanos() / 1_000;
2525
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(&dur).subsec_micros()`
2626

27-
error: Calling `subsec_micros()` is more concise than this calculation
27+
error: calling `subsec_micros()` is more concise than this calculation
2828
--> $DIR/duration_subsec.rs:25:13
2929
|
3030
LL | let _ = dur.subsec_nanos() / NANOS_IN_MICRO;

tests/ui/enum_clike_unportable_variant.stderr

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,54 @@
1-
error: Clike enum variant discriminant is not portable to 32-bit targets
1+
error: C-like enum variant discriminant is not portable to 32-bit targets
22
--> $DIR/enum_clike_unportable_variant.rs:8:5
33
|
44
LL | X = 0x1_0000_0000,
55
| ^^^^^^^^^^^^^^^^^
66
|
77
= note: `-D clippy::enum-clike-unportable-variant` implied by `-D warnings`
88

9-
error: Clike enum variant discriminant is not portable to 32-bit targets
9+
error: C-like enum variant discriminant is not portable to 32-bit targets
1010
--> $DIR/enum_clike_unportable_variant.rs:15:5
1111
|
1212
LL | X = 0x1_0000_0000,
1313
| ^^^^^^^^^^^^^^^^^
1414

15-
error: Clike enum variant discriminant is not portable to 32-bit targets
15+
error: C-like enum variant discriminant is not portable to 32-bit targets
1616
--> $DIR/enum_clike_unportable_variant.rs:18:5
1717
|
1818
LL | A = 0xFFFF_FFFF,
1919
| ^^^^^^^^^^^^^^^
2020

21-
error: Clike enum variant discriminant is not portable to 32-bit targets
21+
error: C-like enum variant discriminant is not portable to 32-bit targets
2222
--> $DIR/enum_clike_unportable_variant.rs:25:5
2323
|
2424
LL | Z = 0xFFFF_FFFF,
2525
| ^^^^^^^^^^^^^^^
2626

27-
error: Clike enum variant discriminant is not portable to 32-bit targets
27+
error: C-like enum variant discriminant is not portable to 32-bit targets
2828
--> $DIR/enum_clike_unportable_variant.rs:26:5
2929
|
3030
LL | A = 0x1_0000_0000,
3131
| ^^^^^^^^^^^^^^^^^
3232

33-
error: Clike enum variant discriminant is not portable to 32-bit targets
33+
error: C-like enum variant discriminant is not portable to 32-bit targets
3434
--> $DIR/enum_clike_unportable_variant.rs:28:5
3535
|
3636
LL | C = (i32::MIN as isize) - 1,
3737
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
3838

39-
error: Clike enum variant discriminant is not portable to 32-bit targets
39+
error: C-like enum variant discriminant is not portable to 32-bit targets
4040
--> $DIR/enum_clike_unportable_variant.rs:34:5
4141
|
4242
LL | Z = 0xFFFF_FFFF,
4343
| ^^^^^^^^^^^^^^^
4444

45-
error: Clike enum variant discriminant is not portable to 32-bit targets
45+
error: C-like enum variant discriminant is not portable to 32-bit targets
4646
--> $DIR/enum_clike_unportable_variant.rs:35:5
4747
|
4848
LL | A = 0x1_0000_0000,
4949
| ^^^^^^^^^^^^^^^^^
5050

51-
error: Clike enum variant discriminant is not portable to 32-bit targets
51+
error: C-like enum variant discriminant is not portable to 32-bit targets
5252
--> $DIR/enum_clike_unportable_variant.rs:40:5
5353
|
5454
LL | X = <usize as Trait>::Number,

tests/ui/enum_variants.stderr

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
1-
error: Variant name ends with the enum's name
1+
error: variant name ends with the enum's name
22
--> $DIR/enum_variants.rs:16:5
33
|
44
LL | cFoo,
55
| ^^^^
66
|
77
= note: `-D clippy::enum-variant-names` implied by `-D warnings`
88

9-
error: Variant name starts with the enum's name
9+
error: variant name starts with the enum's name
1010
--> $DIR/enum_variants.rs:27:5
1111
|
1212
LL | FoodGood,
1313
| ^^^^^^^^
1414

15-
error: Variant name starts with the enum's name
15+
error: variant name starts with the enum's name
1616
--> $DIR/enum_variants.rs:28:5
1717
|
1818
LL | FoodMiddle,
1919
| ^^^^^^^^^^
2020

21-
error: Variant name starts with the enum's name
21+
error: variant name starts with the enum's name
2222
--> $DIR/enum_variants.rs:29:5
2323
|
2424
LL | FoodBad,
2525
| ^^^^^^^
2626

27-
error: All variants have the same prefix: `Food`
27+
error: all variants have the same prefix: `Food`
2828
--> $DIR/enum_variants.rs:26:1
2929
|
3030
LL | / enum Food {
@@ -36,7 +36,7 @@ LL | | }
3636
|
3737
= help: remove the prefixes and use full paths to the variants instead of glob imports
3838

39-
error: All variants have the same prefix: `CallType`
39+
error: all variants have the same prefix: `CallType`
4040
--> $DIR/enum_variants.rs:36:1
4141
|
4242
LL | / enum BadCallType {
@@ -48,7 +48,7 @@ LL | | }
4848
|
4949
= help: remove the prefixes and use full paths to the variants instead of glob imports
5050

51-
error: All variants have the same prefix: `Constant`
51+
error: all variants have the same prefix: `Constant`
5252
--> $DIR/enum_variants.rs:48:1
5353
|
5454
LL | / enum Consts {
@@ -60,7 +60,7 @@ LL | | }
6060
|
6161
= help: remove the prefixes and use full paths to the variants instead of glob imports
6262

63-
error: All variants have the same prefix: `With`
63+
error: all variants have the same prefix: `With`
6464
--> $DIR/enum_variants.rs:82:1
6565
|
6666
LL | / enum Seallll {
@@ -72,7 +72,7 @@ LL | | }
7272
|
7373
= help: remove the prefixes and use full paths to the variants instead of glob imports
7474

75-
error: All variants have the same prefix: `Prefix`
75+
error: all variants have the same prefix: `Prefix`
7676
--> $DIR/enum_variants.rs:88:1
7777
|
7878
LL | / enum NonCaps {
@@ -84,7 +84,7 @@ LL | | }
8484
|
8585
= help: remove the prefixes and use full paths to the variants instead of glob imports
8686

87-
error: All variants have the same prefix: `With`
87+
error: all variants have the same prefix: `With`
8888
--> $DIR/enum_variants.rs:94:1
8989
|
9090
LL | / pub enum PubSeall {

0 commit comments

Comments
 (0)