impl<'tcx> LateLintPass<'tcx> for OpenOptions {
fn check_expr(&mut self, cx: &LateContext<'tcx>, e: &'tcx Expr<'_>) {
- if let ExprKind::MethodCall(ref path, _, ref arguments, _) = e.kind {
+ if let ExprKind::MethodCall(path, _, arguments, _) = e.kind {
let obj_ty = cx.typeck_results().expr_ty(&arguments[0]).peel_refs();
if path.ident.name == sym!(open) && match_type(cx, obj_ty, &paths::OPEN_OPTIONS) {
let mut options = Vec::new();
}
fn get_open_options(cx: &LateContext<'_>, argument: &Expr<'_>, options: &mut Vec<(OpenOption, Argument)>) {
- if let ExprKind::MethodCall(ref path, _, ref arguments, _) = argument.kind {
+ if let ExprKind::MethodCall(path, _, arguments, _) = argument.kind {
let obj_ty = cx.typeck_results().expr_ty(&arguments[0]).peel_refs();
// Only proceed if this is a call on some object of type std::fs::OpenOptions
"the method `create` is called more than once",
);
} else {
- create = true
+ create = true;
}
create_arg = create_arg || (arg == Argument::True);
},
"the method `append` is called more than once",
);
} else {
- append = true
+ append = true;
}
append_arg = append_arg || (arg == Argument::True);
},
"the method `truncate` is called more than once",
);
} else {
- truncate = true
+ truncate = true;
}
truncate_arg = truncate_arg || (arg == Argument::True);
},
"the method `read` is called more than once",
);
} else {
- read = true
+ read = true;
}
read_arg = read_arg || (arg == Argument::True);
},
"the method `write` is called more than once",
);
} else {
- write = true
+ write = true;
}
write_arg = write_arg || (arg == Argument::True);
},