]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/utils/sugg.rs
Handle InlineAsm in clippy
[rust.git] / clippy_lints / src / utils / sugg.rs
index 05cc4f33eaedef66f5acdee69e3acdff599119c4..4ebe2e2852fb4445492161c8bfd693db4dc4fed1 100644 (file)
@@ -2,7 +2,6 @@
 #![deny(clippy::missing_docs_in_private_items)]
 
 use crate::utils::{higher, snippet, snippet_opt, snippet_with_macro_callsite};
-use matches::matches;
 use rustc_ast::util::parser::AssocOp;
 use rustc_ast::{ast, token};
 use rustc_ast_pretty::pprust::token_kind_to_string;
@@ -15,8 +14,6 @@
 use std::convert::TryInto;
 use std::fmt::Display;
 
-pub use crate::literal_representation::format_numeric_literal;
-
 /// A helper type to build suggestion correctly handling parenthesis.
 pub enum Sugg<'a> {
     /// An expression that never needs parenthesis such as `1337` or `[0; 42]`.
@@ -112,6 +109,7 @@ fn hir_from_snippet(cx: &LateContext<'_, '_>, expr: &hir::Expr<'_>, snippet: Cow
             | hir::ExprKind::Field(..)
             | hir::ExprKind::Index(..)
             | hir::ExprKind::InlineAsm(..)
+            | hir::ExprKind::LlvmInlineAsm(..)
             | hir::ExprKind::Lit(..)
             | hir::ExprKind::Loop(..)
             | hir::ExprKind::MethodCall(..)
@@ -154,9 +152,10 @@ pub fn ast(cx: &EarlyContext<'_>, expr: &ast::Expr, default: &'a str) -> Self {
             | ast::ExprKind::ForLoop(..)
             | ast::ExprKind::Index(..)
             | ast::ExprKind::InlineAsm(..)
+            | ast::ExprKind::LlvmInlineAsm(..)
             | ast::ExprKind::Lit(..)
             | ast::ExprKind::Loop(..)
-            | ast::ExprKind::Mac(..)
+            | ast::ExprKind::MacCall(..)
             | ast::ExprKind::MethodCall(..)
             | ast::ExprKind::Paren(..)
             | ast::ExprKind::Path(..)
@@ -518,7 +517,7 @@ pub trait DiagnosticBuilderExt<'a, T: LintContext> {
     /// # Example
     ///
     /// ```rust,ignore
-    /// db.suggest_item_with_attr(cx, item, "#[derive(Default)]");
+    /// diag.suggest_item_with_attr(cx, item, "#[derive(Default)]");
     /// ```
     fn suggest_item_with_attr<D: Display + ?Sized>(
         &mut self,
@@ -536,7 +535,7 @@ fn suggest_item_with_attr<D: Display + ?Sized>(
     /// # Example
     ///
     /// ```rust,ignore
-    /// db.suggest_prepend_item(cx, item,
+    /// diag.suggest_prepend_item(cx, item,
     /// "fn foo() {
     ///     bar();
     /// }");
@@ -552,7 +551,7 @@ fn suggest_item_with_attr<D: Display + ?Sized>(
     /// # Example
     ///
     /// ```rust,ignore
-    /// db.suggest_remove_item(cx, item, "remove this")
+    /// diag.suggest_remove_item(cx, item, "remove this")
     /// ```
     fn suggest_remove_item(&mut self, cx: &T, item: Span, msg: &str, applicability: Applicability);
 }