Skip to content

Commit d9f9278

Browse files
committed
Restrict lint logic.
Restrict lint logic to apply on edition2018 only.
1 parent 37abf6d commit d9f9278

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

clippy_lints/src/single_component_use_path.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use rustc_session::{declare_lint_pass, declare_tool_lint};
44
use syntax::ast::{Item, ItemKind};
55
use if_chain::if_chain;
66
use rustc_errors::Applicability;
7+
use rustc_span::edition::Edition;
78

89
declare_clippy_lint! {
910
/// **What it does:** Checking for imports with single component use path.
@@ -32,6 +33,7 @@ declare_lint_pass!(SingleComponentUsePath => [SINGLE_COMPONENT_USE_PATH]);
3233
impl EarlyLintPass for SingleComponentUsePath {
3334
fn check_item(&mut self, cx: &EarlyContext<'_>, item: &Item) {
3435
if_chain! {
36+
if cx.sess.opts.edition == Edition::Edition2018;
3537
if let ItemKind::Use(use_tree) = &item.kind;
3638
if let segments = &use_tree.prefix.segments;
3739
if segments.len() == 1;

0 commit comments

Comments
 (0)