-use crate::utils::sym;
use crate::utils::{match_type, paths, span_lint, walk_ptrs_ty};
use rustc::hir::{Expr, ExprKind};
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) {
if let ExprKind::MethodCall(ref path, _, ref arguments) = e.node {
let obj_ty = walk_ptrs_ty(cx.tables.expr_ty(&arguments[0]));
- if path.ident.name == *sym::open && match_type(cx, obj_ty, &*paths::OPEN_OPTIONS) {
+ if path.ident.name == sym!(open) && match_type(cx, obj_ty, &paths::OPEN_OPTIONS) {
let mut options = Vec::new();
get_open_options(cx, &arguments[0], &mut options);
check_open_options(cx, &options, e.span);
let obj_ty = walk_ptrs_ty(cx.tables.expr_ty(&arguments[0]));
// Only proceed if this is a call on some object of type std::fs::OpenOptions
- if match_type(cx, obj_ty, &*paths::OPEN_OPTIONS) && arguments.len() >= 2 {
+ if match_type(cx, obj_ty, &paths::OPEN_OPTIONS) && arguments.len() >= 2 {
let argument_option = match arguments[1].node {
ExprKind::Lit(ref span) => {
if let Spanned {
} else {
create = true
}
- create_arg = create_arg || (arg == Argument::True);;
+ create_arg = create_arg || (arg == Argument::True);
},
(OpenOption::Append, arg) => {
if append {
} else {
append = true
}
- append_arg = append_arg || (arg == Argument::True);;
+ append_arg = append_arg || (arg == Argument::True);
},
(OpenOption::Truncate, arg) => {
if truncate {
} else {
read = true
}
- read_arg = read_arg || (arg == Argument::True);;
+ read_arg = read_arg || (arg == Argument::True);
},
(OpenOption::Write, arg) => {
if write {
} else {
write = true
}
- write_arg = write_arg || (arg == Argument::True);;
+ write_arg = write_arg || (arg == Argument::True);
},
}
}