fmt clippy
This commit is contained in:
parent
839ad09689
commit
c9342d0121
41 changed files with 2187 additions and 1488 deletions
|
@ -36,13 +36,12 @@ impl LateLintPass for UnnecessaryMutPassed {
|
|||
match borrowed_table.node_types.get(&fn_expr.id) {
|
||||
Some(function_type) => {
|
||||
if let ExprPath(_, ref path) = fn_expr.node {
|
||||
check_arguments(cx, &arguments, function_type,
|
||||
&format!("{}", path));
|
||||
check_arguments(cx, &arguments, function_type, &format!("{}", path));
|
||||
}
|
||||
}
|
||||
None => unreachable!(), // A function with unknown type is called.
|
||||
// If this happened the compiler would have aborted the
|
||||
// compilation long ago.
|
||||
// If this happened the compiler would have aborted the
|
||||
// compilation long ago.
|
||||
};
|
||||
|
||||
|
||||
|
@ -50,8 +49,9 @@ impl LateLintPass for UnnecessaryMutPassed {
|
|||
ExprMethodCall(ref name, _, ref arguments) => {
|
||||
let method_call = MethodCall::expr(e.id);
|
||||
match borrowed_table.method_map.get(&method_call) {
|
||||
Some(method_type) => check_arguments(cx, &arguments, method_type.ty,
|
||||
&format!("{}", name.node.as_str())),
|
||||
Some(method_type) => {
|
||||
check_arguments(cx, &arguments, method_type.ty, &format!("{}", name.node.as_str()))
|
||||
}
|
||||
None => unreachable!(), // Just like above, this should never happen.
|
||||
};
|
||||
}
|
||||
|
@ -68,10 +68,10 @@ fn check_arguments(cx: &LateContext, arguments: &[P<Expr>], type_definition: &Ty
|
|||
TypeVariants::TyRef(_, TypeAndMut {mutbl: MutImmutable, ..}) |
|
||||
TypeVariants::TyRawPtr(TypeAndMut {mutbl: MutImmutable, ..}) => {
|
||||
if let ExprAddrOf(MutMutable, _) = argument.node {
|
||||
span_lint(cx, UNNECESSARY_MUT_PASSED,
|
||||
argument.span, &format!("The function/method \"{}\" \
|
||||
doesn't need a mutable reference",
|
||||
name));
|
||||
span_lint(cx,
|
||||
UNNECESSARY_MUT_PASSED,
|
||||
argument.span,
|
||||
&format!("The function/method \"{}\" doesn't need a mutable reference", name));
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue