Skip to content

Commit cc5bfd4

Browse files
committed
Auto merge of rust-lang#5888 - matthiaskrgr:lints, r=yaahc
make a bunch of lints texts adhere to rustc dev guide According to the rustc-dev guide: "The text should be matter of fact and avoid capitalization and periods, unless multiple sentences are needed" changelog: make some lint output adhere to the rustc-dev guide
2 parents 1683189 + 6d0b5e2 commit cc5bfd4

Some content is hidden

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

49 files changed

+193
-206
lines changed

clippy_lints/src/attrs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ fn check_empty_line_after_outer_attr(cx: &EarlyContext<'_>, item: &rustc_ast::as
605605
cx,
606606
EMPTY_LINE_AFTER_OUTER_ATTR,
607607
begin_of_attr_to_item,
608-
"Found an empty line after an outer attribute. \
608+
"found an empty line after an outer attribute. \
609609
Perhaps you forgot to add a `!` to make it an inner attribute?",
610610
);
611611
}

clippy_lints/src/bytecount.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ impl<'tcx> LateLintPass<'tcx> for ByteCount {
8282
cx,
8383
NAIVE_BYTECOUNT,
8484
expr.span,
85-
"You appear to be counting bytes the naive way",
86-
"Consider using the bytecount crate",
85+
"you appear to be counting bytes the naive way",
86+
"consider using the bytecount crate",
8787
format!("bytecount::count({}, {})",
8888
snippet_with_applicability(cx, haystack.span, "..", &mut applicability),
8989
snippet_with_applicability(cx, needle.span, "..", &mut applicability)),

clippy_lints/src/checked_conversions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ impl<'tcx> LateLintPass<'tcx> for CheckedConversions {
6666
cx,
6767
CHECKED_CONVERSIONS,
6868
item.span,
69-
"Checked cast can be simplified.",
69+
"checked cast can be simplified",
7070
"try",
7171
format!("{}::try_from({}).is_ok()", to_type, snippet),
7272
applicability,

clippy_lints/src/default_trait_access.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ impl<'tcx> LateLintPass<'tcx> for DefaultTraitAccess {
6161
cx,
6262
DEFAULT_TRAIT_ACCESS,
6363
expr.span,
64-
&format!("Calling `{}` is more clear than this expression", replacement),
64+
&format!("calling `{}` is more clear than this expression", replacement),
6565
"try",
6666
replacement,
6767
Applicability::Unspecified, // First resolve the TODO above

clippy_lints/src/double_comparison.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ impl<'tcx> DoubleComparisons {
6060
cx,
6161
DOUBLE_COMPARISONS,
6262
span,
63-
"This binary expression can be simplified",
63+
"this binary expression can be simplified",
6464
"try",
6565
sugg,
6666
applicability,

clippy_lints/src/double_parens.rs

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -45,41 +45,28 @@ impl EarlyLintPass for DoubleParens {
4545
return;
4646
}
4747

48+
let msg: &str = "consider removing unnecessary double parentheses";
49+
4850
match expr.kind {
4951
ExprKind::Paren(ref in_paren) => match in_paren.kind {
5052
ExprKind::Paren(_) | ExprKind::Tup(_) => {
51-
span_lint(
52-
cx,
53-
DOUBLE_PARENS,
54-
expr.span,
55-
"Consider removing unnecessary double parentheses",
56-
);
53+
span_lint(cx, DOUBLE_PARENS, expr.span, &msg);
5754
},
5855
_ => {},
5956
},
6057
ExprKind::Call(_, ref params) => {
6158
if params.len() == 1 {
6259
let param = &params[0];
6360
if let ExprKind::Paren(_) = param.kind {
64-
span_lint(
65-
cx,
66-
DOUBLE_PARENS,
67-
param.span,
68-
"Consider removing unnecessary double parentheses",
69-
);
61+
span_lint(cx, DOUBLE_PARENS, param.span, &msg);
7062
}
7163
}
7264
},
7365
ExprKind::MethodCall(_, ref params, _) => {
7466
if params.len() == 2 {
7567
let param = &params[1];
7668
if let ExprKind::Paren(_) = param.kind {
77-
span_lint(
78-
cx,
79-
DOUBLE_PARENS,
80-
param.span,
81-
"Consider removing unnecessary double parentheses",
82-
);
69+
span_lint(cx, DOUBLE_PARENS, param.span, &msg);
8370
}
8471
}
8572
},

clippy_lints/src/drop_bounds.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ declare_clippy_lint! {
3333
/// ```
3434
pub DROP_BOUNDS,
3535
correctness,
36-
"Bounds of the form `T: Drop` are useless"
36+
"bounds of the form `T: Drop` are useless"
3737
}
3838

39-
const DROP_BOUNDS_SUMMARY: &str = "Bounds of the form `T: Drop` are useless. \
40-
Use `std::mem::needs_drop` to detect if a type has drop glue.";
39+
const DROP_BOUNDS_SUMMARY: &str = "bounds of the form `T: Drop` are useless, \
40+
use `std::mem::needs_drop` to detect if a type has drop glue";
4141

4242
declare_lint_pass!(DropBounds => [DROP_BOUNDS]);
4343

clippy_lints/src/functions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ impl<'tcx> Functions {
374374
}
375375

376376
if line_count > self.max_lines {
377-
span_lint(cx, TOO_MANY_LINES, span, "This function has a large number of lines.")
377+
span_lint(cx, TOO_MANY_LINES, span, "this function has a large number of lines")
378378
}
379379
}
380380

clippy_lints/src/misc_early.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ impl EarlyLintPass for MiscEarlyLints {
271271
cx,
272272
BUILTIN_TYPE_SHADOW,
273273
param.ident.span,
274-
&format!("This generic shadows the built-in type `{}`", name),
274+
&format!("this generic shadows the built-in type `{}`", name),
275275
);
276276
}
277277
}
@@ -298,9 +298,9 @@ impl EarlyLintPass for MiscEarlyLints {
298298
cx,
299299
UNNEEDED_FIELD_PATTERN,
300300
pat.span,
301-
"All the struct fields are matched to a wildcard pattern, consider using `..`.",
301+
"all the struct fields are matched to a wildcard pattern, consider using `..`",
302302
None,
303-
&format!("Try with `{} {{ .. }}` instead", type_name),
303+
&format!("try with `{} {{ .. }}` instead", type_name),
304304
);
305305
return;
306306
}
@@ -313,7 +313,7 @@ impl EarlyLintPass for MiscEarlyLints {
313313
cx,
314314
UNNEEDED_FIELD_PATTERN,
315315
field.span,
316-
"You matched a field with a wildcard pattern. Consider using `..` instead",
316+
"you matched a field with a wildcard pattern, consider using `..` instead",
317317
);
318318
} else {
319319
let mut normal = vec![];
@@ -333,10 +333,10 @@ impl EarlyLintPass for MiscEarlyLints {
333333
cx,
334334
UNNEEDED_FIELD_PATTERN,
335335
field.span,
336-
"You matched a field with a wildcard pattern. Consider using `..` \
336+
"you matched a field with a wildcard pattern, consider using `..` \
337337
instead",
338338
None,
339-
&format!("Try with `{} {{ {}, .. }}`", type_name, normal[..].join(", ")),
339+
&format!("try with `{} {{ {}, .. }}`", type_name, normal[..].join(", ")),
340340
);
341341
}
342342
}

clippy_lints/src/needless_bool.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ fn check_comparison<'a, 'tcx>(
243243
cx,
244244
BOOL_COMPARISON,
245245
e.span,
246-
"This comparison might be written more concisely",
246+
"this comparison might be written more concisely",
247247
"try simplifying it as shown",
248248
format!(
249249
"{} != {}",

0 commit comments

Comments
 (0)