X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=clippy_lints%2Fsrc%2Funused_label.rs;h=5c5550ed30fb2e675a3059f6b1d13e941a11ea37;hb=48cb6e273ea49e85b6baa209e0123a2bbd6d15c2;hp=b009420bdb619da750c1a9c293ccd5ceea7e16c1;hpb=a47734c41d5ebc73bf0b457cf8f9075841132c28;p=rust.git diff --git a/clippy_lints/src/unused_label.rs b/clippy_lints/src/unused_label.rs index b009420bdb6..5c5550ed30f 100644 --- a/clippy_lints/src/unused_label.rs +++ b/clippy_lints/src/unused_label.rs @@ -4,8 +4,8 @@ use std::collections::HashMap; use syntax::ast; use syntax::codemap::Span; -use syntax::symbol::InternedString; -use utils::{in_macro, span_lint}; +use syntax::symbol::LocalInternedString; +use crate::utils::{in_macro, span_lint}; /// **What it does:** Checks for unused labels. /// @@ -30,7 +30,7 @@ pub struct UnusedLabel; struct UnusedLabelVisitor<'a, 'tcx: 'a> { - labels: HashMap, + labels: HashMap, cx: &'a LateContext<'a, 'tcx>, } @@ -69,11 +69,11 @@ fn check_fn( impl<'a, 'tcx: 'a> Visitor<'tcx> for UnusedLabelVisitor<'a, 'tcx> { fn visit_expr(&mut self, expr: &'tcx hir::Expr) { match expr.node { - hir::ExprBreak(destination, _) | hir::ExprAgain(destination) => if let Some(label) = destination.label { - self.labels.remove(&label.name.as_str()); + hir::ExprBreak(destination, _) | hir::ExprContinue(destination) => if let Some(label) = destination.label { + self.labels.remove(&label.ident.as_str()); }, hir::ExprLoop(_, Some(label), _) | hir::ExprWhile(_, _, Some(label)) => { - self.labels.insert(label.name.as_str(), expr.span); + self.labels.insert(label.ident.as_str(), expr.span); }, _ => (), }