Skip to content

Commit abf7f91

Browse files
committed
Auto merge of #3945 - flip1995:rustup, r=phansch
Rustup cc rust-lang/rust#59227 (comment) This fix is obsolet once rust-lang/rust#59779 and #3926 is merged.
2 parents 6104aef + 3fe5eea commit abf7f91

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

clippy_lints/src/consts.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use std::convert::TryInto;
1616
use std::hash::{Hash, Hasher};
1717
use syntax::ast::{FloatTy, LitKind};
1818
use syntax::ptr::P;
19-
use syntax_pos::symbol::Symbol;
19+
use syntax_pos::symbol::{LocalInternedString, Symbol};
2020

2121
/// A `LitKind`-like enum to fold constant `Expr`s into.
2222
#[derive(Debug, Clone)]
@@ -249,7 +249,10 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
249249
if let ExprKind::Path(qpath) = &callee.node;
250250
let def = self.tables.qpath_def(qpath, callee.hir_id);
251251
if let Some(def_id) = def.opt_def_id();
252-
let def_path = get_def_path(self.tcx, def_id);
252+
let def_path = get_def_path(self.tcx, def_id)
253+
.iter()
254+
.map(LocalInternedString::get)
255+
.collect::<Vec<_>>();
253256
if let &["core", "num", impl_ty, "max_value"] = &def_path[..];
254257
then {
255258
let value = match impl_ty {

clippy_lints/src/utils/mod.rs

+2-7
Original file line numberDiff line numberDiff line change
@@ -220,13 +220,8 @@ pub fn match_def_path<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId, path
220220
/// // The given `def_id` is that of an `Option` type
221221
/// };
222222
/// ```
223-
pub fn get_def_path<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Vec<&'static str> {
224-
AbsolutePathPrinter { tcx }
225-
.print_def_path(def_id, &[])
226-
.unwrap()
227-
.iter()
228-
.map(LocalInternedString::get)
229-
.collect()
223+
pub fn get_def_path<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Vec<LocalInternedString> {
224+
AbsolutePathPrinter { tcx }.print_def_path(def_id, &[]).unwrap()
230225
}
231226

232227
/// Checks if type is struct, enum or union type with the given def path.

0 commit comments

Comments
 (0)