Skip to content

Commit 8eb2bd1

Browse files
committed
update the lint messages and tests
1 parent 5370576 commit 8eb2bd1

Some content is hidden

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

54 files changed

+315
-315
lines changed

clippy_lints/src/assign_ops.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ fn lint_misrefactored_assign_op(
209209
diag.span_suggestion(
210210
expr.span,
211211
&format!(
212-
"Did you mean `{} = {} {} {}` or `{}`? Consider replacing it with",
212+
"did you mean `{} = {} {} {}` or `{}`? Consider replacing it with",
213213
snip_a,
214214
snip_a,
215215
op.node.as_str(),

clippy_lints/src/attrs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ fn check_mismatched_target_os(cx: &EarlyContext<'_>, attr: &Attribute) {
639639
diag.span_suggestion(span, "try", sugg, Applicability::MaybeIncorrect);
640640

641641
if !unix_suggested && is_unix(os) {
642-
diag.help("Did you mean `unix`?");
642+
diag.help("did you mean `unix`?");
643643
unix_suggested = true;
644644
}
645645
}

clippy_lints/src/await_holding_invalid.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ fn check_interior_types(cx: &LateContext<'_>, ty_causes: &[GeneratorInteriorType
116116
cx,
117117
AWAIT_HOLDING_LOCK,
118118
ty_cause.span,
119-
"this MutexGuard is held across an 'await' point. Consider using an async-aware Mutex type or ensuring the MutexGuard is dropped before calling await.",
119+
"this MutexGuard is held across an 'await' point. Consider using an async-aware Mutex type or ensuring the MutexGuard is dropped before calling await",
120120
ty_cause.scope_span.or(Some(span)),
121121
"these are all the await points this lock is held through",
122122
);
@@ -126,7 +126,7 @@ fn check_interior_types(cx: &LateContext<'_>, ty_causes: &[GeneratorInteriorType
126126
cx,
127127
AWAIT_HOLDING_REFCELL_REF,
128128
ty_cause.span,
129-
"this RefCell Ref is held across an 'await' point. Consider ensuring the Ref is dropped before calling await.",
129+
"this RefCell Ref is held across an 'await' point. Consider ensuring the Ref is dropped before calling await",
130130
ty_cause.scope_span.or(Some(span)),
131131
"these are all the await points this ref is held through",
132132
);

clippy_lints/src/comparison_chain.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ impl<'tcx> LateLintPass<'tcx> for ComparisonChain {
117117
expr.span,
118118
"`if` chain can be rewritten with `match`",
119119
None,
120-
"Consider rewriting the `if` chain to use `cmp` and `match`.",
120+
"consider rewriting the `if` chain to use `cmp` and `match`",
121121
)
122122
}
123123
}

clippy_lints/src/drop_forget_ref.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,13 @@ declare_clippy_lint! {
9898
}
9999

100100
const DROP_REF_SUMMARY: &str = "calls to `std::mem::drop` with a reference instead of an owned value. \
101-
Dropping a reference does nothing.";
101+
Dropping a reference does nothing";
102102
const FORGET_REF_SUMMARY: &str = "calls to `std::mem::forget` with a reference instead of an owned value. \
103-
Forgetting a reference does nothing.";
103+
Forgetting a reference does nothing";
104104
const DROP_COPY_SUMMARY: &str = "calls to `std::mem::drop` with a value that implements `Copy`. \
105-
Dropping a copy leaves the original intact.";
105+
Dropping a copy leaves the original intact";
106106
const FORGET_COPY_SUMMARY: &str = "calls to `std::mem::forget` with a value that implements `Copy`. \
107-
Forgetting a copy leaves the original intact.";
107+
Forgetting a copy leaves the original intact";
108108

109109
declare_lint_pass!(DropForgetRef => [DROP_REF, FORGET_REF, DROP_COPY, FORGET_COPY]);
110110

clippy_lints/src/fallible_impl_from.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ fn lint_impl_body<'tcx>(cx: &LateContext<'tcx>, impl_span: Span, impl_items: &[h
133133
move |diag| {
134134
diag.help(
135135
"`From` is intended for infallible conversions only. \
136-
Use `TryFrom` if there's a possibility for the conversion to fail.");
136+
Use `TryFrom` if there's a possibility for the conversion to fail");
137137
diag.span_note(fpu.result, "potential failure(s)");
138138
});
139139
}

clippy_lints/src/indexing_slicing.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,13 @@ impl<'tcx> LateLintPass<'tcx> for IndexingSlicing {
132132
}
133133

134134
let help_msg = match (range.start, range.end) {
135-
(None, Some(_)) => "Consider using `.get(..n)`or `.get_mut(..n)` instead",
136-
(Some(_), None) => "Consider using `.get(n..)` or .get_mut(n..)` instead",
137-
(Some(_), Some(_)) => "Consider using `.get(n..m)` or `.get_mut(n..m)` instead",
135+
(None, Some(_)) => "consider using `.get(..n)`or `.get_mut(..n)` instead",
136+
(Some(_), None) => "consider using `.get(n..)` or .get_mut(n..)` instead",
137+
(Some(_), Some(_)) => "consider using `.get(n..m)` or `.get_mut(n..m)` instead",
138138
(None, None) => return, // [..] is ok.
139139
};
140140

141-
span_lint_and_help(cx, INDEXING_SLICING, expr.span, "slicing may panic.", None, help_msg);
141+
span_lint_and_help(cx, INDEXING_SLICING, expr.span, "slicing may panic", None, help_msg);
142142
} else {
143143
// Catchall non-range index, i.e., [n] or [n << m]
144144
if let ty::Array(..) = ty.kind() {
@@ -153,9 +153,9 @@ impl<'tcx> LateLintPass<'tcx> for IndexingSlicing {
153153
cx,
154154
INDEXING_SLICING,
155155
expr.span,
156-
"indexing may panic.",
156+
"indexing may panic",
157157
None,
158-
"Consider using `.get(n)` or `.get_mut(n)` instead",
158+
"consider using `.get(n)` or `.get_mut(n)` instead",
159159
);
160160
}
161161
}

clippy_lints/src/integer_division.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ impl<'tcx> LateLintPass<'tcx> for IntegerDivision {
3939
expr.span,
4040
"integer division",
4141
None,
42-
"division of integers may cause loss of precision. consider using floats.",
42+
"division of integers may cause loss of precision. consider using floats",
4343
);
4444
}
4545
}

clippy_lints/src/loops.rs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1625,10 +1625,7 @@ fn check_for_loop_range<'tcx>(
16251625
cx,
16261626
NEEDLESS_RANGE_LOOP,
16271627
expr.span,
1628-
&format!(
1629-
"the loop variable `{}` is only used to index `{}`.",
1630-
ident.name, indexed
1631-
),
1628+
&format!("the loop variable `{}` is only used to index `{}`", ident.name, indexed),
16321629
|diag| {
16331630
multispan_sugg(
16341631
diag,
@@ -1763,7 +1760,7 @@ fn check_arg_type(cx: &LateContext<'_>, pat: &Pat<'_>, arg: &Expr<'_>) {
17631760
arg.span,
17641761
&format!(
17651762
"for loop over `{0}`, which is an `Option`. This is more readably written as an \
1766-
`if let` statement.",
1763+
`if let` statement",
17671764
snippet(cx, arg.span, "_")
17681765
),
17691766
None,
@@ -1780,7 +1777,7 @@ fn check_arg_type(cx: &LateContext<'_>, pat: &Pat<'_>, arg: &Expr<'_>) {
17801777
arg.span,
17811778
&format!(
17821779
"for loop over `{0}`, which is a `Result`. This is more readably written as an \
1783-
`if let` statement.",
1780+
`if let` statement",
17841781
snippet(cx, arg.span, "_")
17851782
),
17861783
None,
@@ -1826,7 +1823,7 @@ fn check_for_loop_explicit_counter<'tcx>(
18261823
cx,
18271824
EXPLICIT_COUNTER_LOOP,
18281825
for_span.with_hi(arg.span.hi()),
1829-
&format!("the variable `{}` is used as a loop counter.", name),
1826+
&format!("the variable `{}` is used as a loop counter", name),
18301827
"consider using",
18311828
format!(
18321829
"for ({}, {}) in {}.enumerate()",
@@ -3055,16 +3052,16 @@ impl IterFunction {
30553052
fn get_suggestion_text(&self) -> &'static str {
30563053
match &self.func {
30573054
IterFunctionKind::IntoIter => {
3058-
"Use the original Iterator instead of collecting it and then producing a new one"
3055+
"use the original Iterator instead of collecting it and then producing a new one"
30593056
},
30603057
IterFunctionKind::Len => {
3061-
"Take the original Iterator's count instead of collecting it and finding the length"
3058+
"take the original Iterator's count instead of collecting it and finding the length"
30623059
},
30633060
IterFunctionKind::IsEmpty => {
3064-
"Check if the original Iterator has anything instead of collecting it and seeing if it's empty"
3061+
"check if the original Iterator has anything instead of collecting it and seeing if it's empty"
30653062
},
30663063
IterFunctionKind::Contains(_) => {
3067-
"Check if the original Iterator contains an element instead of collecting then checking"
3064+
"check if the original Iterator contains an element instead of collecting then checking"
30683065
},
30693066
}
30703067
}

clippy_lints/src/matches.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,9 +1173,9 @@ fn check_wild_in_or_pats(cx: &LateContext<'_>, arms: &[Arm<'_>]) {
11731173
cx,
11741174
WILDCARD_IN_OR_PATTERNS,
11751175
arm.pat.span,
1176-
"wildcard pattern covers any other pattern as it will match anyway.",
1176+
"wildcard pattern covers any other pattern as it will match anyway",
11771177
None,
1178-
"Consider handling `_` separately.",
1178+
"consider handling `_` separately",
11791179
);
11801180
}
11811181
}

0 commit comments

Comments
 (0)