Small cleanup

This commit is contained in:
mcarton 2016-02-20 21:20:56 +01:00
parent ba3be83488
commit 1a64a4890c
5 changed files with 8 additions and 8 deletions

View file

@ -44,14 +44,14 @@ impl LateLintPass for FormatMacLint {
// ensure the format argument is `{}` ie. Display with no fancy option // ensure the format argument is `{}` ie. Display with no fancy option
check_arg_is_display(&args[1]) 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 () { () => [], }` // `format!("foo")` expansion contains `match () { () => [], }`
ExprMatch(ref matchee, _, _) => { ExprMatch(ref matchee, _, _) => {
if let ExprTup(ref tup) = matchee.node { if let ExprTup(ref tup) = matchee.node {
if tup.is_empty() { if tup.is_empty() {
span_lint(cx, USELESS_FORMAT, span, &"useless use of `format!`"); span_lint(cx, USELESS_FORMAT, span, "useless use of `format!`");
} }
} }
} }

View file

@ -317,8 +317,8 @@ impl LateLintPass for LoopsPass {
span_lint(cx, span_lint(cx,
UNUSED_COLLECT, UNUSED_COLLECT,
expr.span, 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"); Consider using an explicit for loop to exhaust the iterator");
} }
} }
} }

View file

@ -589,7 +589,7 @@ fn lint_extend(cx: &LateContext, expr: &Expr, args: &MethodArgs) {
span_lint(cx, span_lint(cx,
EXTEND_FROM_SLICE, EXTEND_FROM_SLICE,
expr.span, 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, .span_suggestion(expr.span,
"try this", "try this",
format!("{}.extend_from_slice({}{})", format!("{}.extend_from_slice({}{})",

View file

@ -105,7 +105,7 @@ impl LateLintPass for RegexPass {
Ok(r) => { Ok(r) => {
if let Some(repl) = is_trivial_regex(&r) { if let Some(repl) = is_trivial_regex(&r) {
span_help_and_lint(cx, TRIVIAL_REGEX, args[0].span, span_help_and_lint(cx, TRIVIAL_REGEX, args[0].span,
&"trivial regex", "trivial regex",
&format!("consider using {}", repl)); &format!("consider using {}", repl));
} }
} }
@ -123,7 +123,7 @@ impl LateLintPass for RegexPass {
Ok(r) => { Ok(r) => {
if let Some(repl) = is_trivial_regex(&r) { if let Some(repl) = is_trivial_regex(&r) {
span_help_and_lint(cx, TRIVIAL_REGEX, args[0].span, span_help_and_lint(cx, TRIVIAL_REGEX, args[0].span,
&"trivial regex", "trivial regex",
&format!("consider using {}", repl)); &format!("consider using {}", repl));
} }
} }

View file

@ -496,7 +496,7 @@ fn check_type(cx: &LateContext, ty: &Ty) {
span_lint(cx, span_lint(cx,
TYPE_COMPLEXITY, TYPE_COMPLEXITY,
ty.span, ty.span,
&"very complex type used. Consider factoring parts into `type` definitions"); "very complex type used. Consider factoring parts into `type` definitions");
} }
} }