Add STD_FS_CREATE_DIR into paths

This commit is contained in:
Hirochika Matsumoto 2020-08-28 18:53:15 +09:00
parent 5574182b4d
commit 607905d126
2 changed files with 3 additions and 2 deletions

View file

@ -1,4 +1,4 @@
use crate::utils::{match_qpath, snippet, span_lint_and_sugg};
use crate::utils::{match_qpath, paths, snippet, span_lint_and_sugg};
use if_chain::if_chain;
use rustc_errors::Applicability;
use rustc_hir::*;
@ -33,7 +33,7 @@ impl LateLintPass<'_> for CreateDir {
if_chain! {
if let ExprKind::Call(ref func, ref args) = expr.kind;
if let ExprKind::Path(ref path) = func.kind;
if match_qpath(path, &["std", "fs", "create_dir"]);
if match_qpath(path, &paths::STD_FS_CREATE_DIR);
then {
span_lint_and_sugg(
cx,

View file

@ -110,6 +110,7 @@ pub const SLICE_ITER: [&str; 3] = ["core", "slice", "Iter"];
pub const STDERR: [&str; 4] = ["std", "io", "stdio", "stderr"];
pub const STDOUT: [&str; 4] = ["std", "io", "stdio", "stdout"];
pub const STD_CONVERT_IDENTITY: [&str; 3] = ["std", "convert", "identity"];
pub const STD_FS_CREATE_DIR: [&str; 3] = ["std", "fs", "create_dir"];
pub const STD_MEM_TRANSMUTE: [&str; 3] = ["std", "mem", "transmute"];
pub const STD_PTR_NULL: [&str; 3] = ["std", "ptr", "null"];
pub const STRING_AS_MUT_STR: [&str; 4] = ["alloc", "string", "String", "as_mut_str"];