Skip to content

Commit

Permalink
Fixing lint message and provide docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
xiongmao86 committed Jan 29, 2020
1 parent 6fa1fef commit b8fc3c7
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions clippy_lints/src/single_component_use_path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,25 @@ use if_chain::if_chain;
use rustc_errors::Applicability;

declare_clippy_lint! {
/// **What it does:** Checking for imports with single component use path.
///
/// **Why is this bad?** Import with single component use path such as `use cratename;`
/// is not necessary in order to use the crate.
///
/// **Known problems:** None.
///
/// **Example:**
///
/// ```rust, ignore
/// use bit_vec;
///
/// fn main() {
/// bit_vec::BitVec::new();
///}
///```
pub SINGLE_COMPONENT_USE_PATH,
style,
"use with single component path is redundant in 2018 edition"
"use with single component path is redundant"
}

declare_lint_pass!(SingleComponentUsePath => [SINGLE_COMPONENT_USE_PATH]);
Expand All @@ -24,7 +40,7 @@ impl EarlyLintPass for SingleComponentUsePath {
cx,
SINGLE_COMPONENT_USE_PATH,
item.span,
"this import is redundant in 2018 edition",
"this import is redundant",
"remove it entirely",
"".to_string(),
Applicability::MachineApplicable
Expand Down

0 comments on commit b8fc3c7

Please sign in to comment.