]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/identity_conversion.rs
Auto merge of #3946 - rchaser53:issue-3920, r=flip1995
[rust.git] / clippy_lints / src / identity_conversion.rs
index b09031b553f9ffccfc7c4b9e18b298c332201baa..7391f0a5208eba617164a51bac329353315d7a25 100644 (file)
@@ -1,24 +1,24 @@
 use crate::utils::{
     in_macro, match_def_path, match_trait_method, same_tys, snippet, snippet_with_macro_callsite, span_lint_and_then,
 };
-use crate::utils::{opt_def_id, paths, resolve_node};
+use crate::utils::{paths, resolve_node};
 use rustc::hir::*;
 use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
 use rustc::{declare_tool_lint, lint_array};
 use rustc_errors::Applicability;
 
-/// **What it does:** Checks for always-identical `Into`/`From`/`IntoIter` conversions.
-///
-/// **Why is this bad?** Redundant code.
-///
-/// **Known problems:** None.
-///
-/// **Example:**
-/// ```rust
-/// // format!() returns a `String`
-/// let s: String = format!("hello").into();
-/// ```
 declare_clippy_lint! {
+    /// **What it does:** Checks for always-identical `Into`/`From`/`IntoIter` conversions.
+    ///
+    /// **Why is this bad?** Redundant code.
+    ///
+    /// **Known problems:** None.
+    ///
+    /// **Example:**
+    /// ```rust
+    /// // format!() returns a `String`
+    /// let s: String = format!("hello").into();
+    /// ```
     pub IDENTITY_CONVERSION,
     complexity,
     "using always-identical `Into`/`From`/`IntoIter` conversions"
@@ -98,7 +98,7 @@ fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) {
 
             ExprKind::Call(ref path, ref args) => {
                 if let ExprKind::Path(ref qpath) = path.node {
-                    if let Some(def_id) = opt_def_id(resolve_node(cx, qpath, path.hir_id)) {
+                    if let Some(def_id) = resolve_node(cx, qpath, path.hir_id).opt_def_id() {
                         if match_def_path(cx.tcx, def_id, &paths::FROM_FROM[..]) {
                             let a = cx.tables.expr_ty(e);
                             let b = cx.tables.expr_ty(&args[0]);