about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-04-12 11:53:08 +0000
committerbors <bors@rust-lang.org>2019-04-12 11:53:08 +0000
commitabf7f911d88e9209b54cfba2776d7dbca5a440ce (patch)
treefde285c1734676e6fa647147bdb9c70ee337ca70
parent6104aefef576c04b36602b6426f90c63be406f69 (diff)
parent3fe5eea4e47921fa4b399a8d58c39e8397ad3ef8 (diff)
downloadrust-abf7f911d88e9209b54cfba2776d7dbca5a440ce.tar.gz
rust-abf7f911d88e9209b54cfba2776d7dbca5a440ce.zip
Auto merge of #3945 - flip1995:rustup, r=phansch
Rustup

cc https://github.com/rust-lang/rust/pull/59227#issuecomment-482411861

This fix is obsolet once rust-lang/rust#59779 and #3926 is merged.
-rw-r--r--clippy_lints/src/consts.rs7
-rw-r--r--clippy_lints/src/utils/mod.rs9
2 files changed, 7 insertions, 9 deletions
diff --git a/clippy_lints/src/consts.rs b/clippy_lints/src/consts.rs
index 66fbf18f3dd..4442d8a2d6b 100644
--- a/clippy_lints/src/consts.rs
+++ b/clippy_lints/src/consts.rs
@@ -16,7 +16,7 @@ use std::convert::TryInto;
 use std::hash::{Hash, Hasher};
 use syntax::ast::{FloatTy, LitKind};
 use syntax::ptr::P;
-use syntax_pos::symbol::Symbol;
+use syntax_pos::symbol::{LocalInternedString, Symbol};
 
 /// A `LitKind`-like enum to fold constant `Expr`s into.
 #[derive(Debug, Clone)]
@@ -249,7 +249,10 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
                     if let ExprKind::Path(qpath) = &callee.node;
                     let def = self.tables.qpath_def(qpath, callee.hir_id);
                     if let Some(def_id) = def.opt_def_id();
-                    let def_path = get_def_path(self.tcx, def_id);
+                    let def_path = get_def_path(self.tcx, def_id)
+                        .iter()
+                        .map(LocalInternedString::get)
+                        .collect::<Vec<_>>();
                     if let &["core", "num", impl_ty, "max_value"] = &def_path[..];
                     then {
                        let value = match impl_ty {
diff --git a/clippy_lints/src/utils/mod.rs b/clippy_lints/src/utils/mod.rs
index 542a18635d3..3383e47ac77 100644
--- a/clippy_lints/src/utils/mod.rs
+++ b/clippy_lints/src/utils/mod.rs
@@ -220,13 +220,8 @@ pub fn match_def_path<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId, path
 ///     // The given `def_id` is that of an `Option` type
 /// };
 /// ```
-pub fn get_def_path<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Vec<&'static str> {
-    AbsolutePathPrinter { tcx }
-        .print_def_path(def_id, &[])
-        .unwrap()
-        .iter()
-        .map(LocalInternedString::get)
-        .collect()
+pub fn get_def_path<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Vec<LocalInternedString> {
+    AbsolutePathPrinter { tcx }.print_def_path(def_id, &[]).unwrap()
 }
 
 /// Checks if type is struct, enum or union type with the given def path.