use crate::utils::span_lint_and_sugg;
-use rustc::declare_lint_pass;
-use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass};
+use rustc_ast::ast;
use rustc_errors::Applicability;
-use rustc_session::declare_tool_lint;
+use rustc_lint::{EarlyContext, EarlyLintPass};
+use rustc_session::{declare_lint_pass, declare_tool_lint};
use rustc_span::source_map::{BytePos, Span};
use std::convert::TryFrom;
-use syntax::ast;
declare_clippy_lint! {
/// **What it does:** Checks doc comments for usage of tab characters.
impl TabsInDocComments {
fn warn_if_tabs_in_doc(cx: &EarlyContext<'_>, attr: &ast::Attribute) {
- if let ast::AttrKind::DocComment(comment) = attr.kind {
+ if let ast::AttrKind::DocComment(_, comment) = attr.kind {
let comment = comment.as_str();
for (lo, hi) in get_chunks_of_tabs(&comment) {
+ // +3 skips the opening delimiter
let new_span = Span::new(
- attr.span.lo() + BytePos(lo),
- attr.span.lo() + BytePos(hi),
+ attr.span.lo() + BytePos(3 + lo),
+ attr.span.lo() + BytePos(3 + hi),
attr.span.ctxt(),
);
span_lint_and_sugg(