mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-24 05:33:27 +00:00
Small cleanup
This commit is contained in:
parent
ba3be83488
commit
1a64a4890c
5 changed files with 8 additions and 8 deletions
|
@ -44,14 +44,14 @@ impl LateLintPass for FormatMacLint {
|
|||
// ensure the format argument is `{}` ie. Display with no fancy option
|
||||
check_arg_is_display(&args[1])
|
||||
], {
|
||||
span_lint(cx, USELESS_FORMAT, span, &"useless use of `format!`");
|
||||
span_lint(cx, USELESS_FORMAT, span, "useless use of `format!`");
|
||||
}}
|
||||
}
|
||||
// `format!("foo")` expansion contains `match () { () => [], }`
|
||||
ExprMatch(ref matchee, _, _) => {
|
||||
if let ExprTup(ref tup) = matchee.node {
|
||||
if tup.is_empty() {
|
||||
span_lint(cx, USELESS_FORMAT, span, &"useless use of `format!`");
|
||||
span_lint(cx, USELESS_FORMAT, span, "useless use of `format!`");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -317,7 +317,7 @@ impl LateLintPass for LoopsPass {
|
|||
span_lint(cx,
|
||||
UNUSED_COLLECT,
|
||||
expr.span,
|
||||
&"you are collect()ing an iterator and throwing away the result. \
|
||||
"you are collect()ing an iterator and throwing away the result. \
|
||||
Consider using an explicit for loop to exhaust the iterator");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -589,7 +589,7 @@ fn lint_extend(cx: &LateContext, expr: &Expr, args: &MethodArgs) {
|
|||
span_lint(cx,
|
||||
EXTEND_FROM_SLICE,
|
||||
expr.span,
|
||||
&"use of `extend` to extend a Vec by a slice")
|
||||
"use of `extend` to extend a Vec by a slice")
|
||||
.span_suggestion(expr.span,
|
||||
"try this",
|
||||
format!("{}.extend_from_slice({}{})",
|
||||
|
|
|
@ -105,7 +105,7 @@ impl LateLintPass for RegexPass {
|
|||
Ok(r) => {
|
||||
if let Some(repl) = is_trivial_regex(&r) {
|
||||
span_help_and_lint(cx, TRIVIAL_REGEX, args[0].span,
|
||||
&"trivial regex",
|
||||
"trivial regex",
|
||||
&format!("consider using {}", repl));
|
||||
}
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ impl LateLintPass for RegexPass {
|
|||
Ok(r) => {
|
||||
if let Some(repl) = is_trivial_regex(&r) {
|
||||
span_help_and_lint(cx, TRIVIAL_REGEX, args[0].span,
|
||||
&"trivial regex",
|
||||
"trivial regex",
|
||||
&format!("consider using {}", repl));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -496,7 +496,7 @@ fn check_type(cx: &LateContext, ty: &Ty) {
|
|||
span_lint(cx,
|
||||
TYPE_COMPLEXITY,
|
||||
ty.span,
|
||||
&"very complex type used. Consider factoring parts into `type` definitions");
|
||||
"very complex type used. Consider factoring parts into `type` definitions");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue