Small cleanup

This commit is contained in:
mcarton 2016-01-29 22:19:14 +01:00
parent 1b9fbd8801
commit 3a39bbaf74
3 changed files with 6 additions and 6 deletions

View file

@ -93,19 +93,19 @@ fn check_for_insert(cx: &LateContext, span: Span, map: &Expr, key: &Expr, expr:
], {
let help = if sole_expr {
format!("{}.entry({}).or_insert({})",
snippet(cx, map.span, ".."),
snippet(cx, map.span, "map"),
snippet(cx, params[1].span, ".."),
snippet(cx, params[2].span, ".."))
}
else {
format!("{}.entry({})",
snippet(cx, map.span, ".."),
snippet(cx, map.span, "map"),
snippet(cx, params[1].span, ".."))
};
span_lint_and_then(cx, MAP_ENTRY, span,
&format!("usage of `contains_key` followed by `insert` on `{}`", kind), |db| {
db.span_suggestion(span, "Consider using", help.clone());
db.span_suggestion(span, "Consider using", help);
});
}
}

View file

@ -223,8 +223,8 @@ fn check_match_bool(cx: &LateContext, ex: &Expr, arms: &[Arm], expr: &Expr) {
expr.span,
"you seem to be trying to match on a boolean expression. Consider using \
an if..else block:", move |db| {
if let Some(ref sugg) = sugg {
db.span_suggestion(expr.span, "try this", sugg.clone());
if let Some(sugg) = sugg {
db.span_suggestion(expr.span, "try this", sugg);
}
});
}

View file

@ -649,7 +649,7 @@ fn is_cast_ty_equal(left: &Ty, right: &Ty) -> bool {
}
}
/// Return the pre-expansion span is this comes from a expansion of the macro `name`.
/// Return the pre-expansion span if is this comes from an expansion of the macro `name`.
pub fn is_expn_of(cx: &LateContext, mut span: Span, name: &str) -> Option<Span> {
loop {
let span_name_span = cx.tcx.sess.codemap().with_expn_info(span.expn_id, |expn| {