Skip to content

Commit 32a9394

Browse files
committed
Rustup
1 parent b7222be commit 32a9394

19 files changed

+118
-81
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Change Log
22
All notable changes to this project will be documented in this file.
33

4+
## 0.0.160
5+
* Update to *rustc 1.22.0-nightly (dd08c3070 2017-09-12)*
6+
47
## 0.0.159
58
* Update to *rustc 1.22.0-nightly (eba374fb2 2017-09-11)*
69
* New lint: [`clone_on_ref_ptr`]

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy"
3-
version = "0.0.159"
3+
version = "0.0.160"
44
authors = [
55
"Manish Goregaokar <[email protected]>",
66
"Andre Bogus <[email protected]>",
@@ -31,7 +31,7 @@ path = "src/main.rs"
3131

3232
[dependencies]
3333
# begin automatic update
34-
clippy_lints = { version = "0.0.159", path = "clippy_lints" }
34+
clippy_lints = { version = "0.0.160", path = "clippy_lints" }
3535
# end automatic update
3636
cargo_metadata = "0.2"
3737

clippy_lints/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "clippy_lints"
33
# begin automatic update
4-
version = "0.0.159"
4+
version = "0.0.160"
55
# end automatic update
66
authors = [
77
"Manish Goregaokar <[email protected]>",

clippy_lints/src/array_indexing.rs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use rustc_const_math::{ConstInt, ConstIsize, ConstUsize};
77
use rustc::hir;
88
use syntax::ast::RangeLimits;
99
use utils::{self, higher};
10+
use utils::const_to_u64;
1011

1112
/// **What it does:** Checks for out of bounds array indexing with a constant
1213
/// index.
@@ -63,21 +64,22 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ArrayIndexing {
6364
let ty = cx.tables.expr_ty(array);
6465
if let ty::TyArray(_, size) = ty.sty {
6566
let size = ConstInt::Usize(
66-
ConstUsize::new(size as u64, cx.sess().target.uint_type).expect("array size is invalid"),
67+
ConstUsize::new(const_to_u64(size), cx.sess().target.usize_ty).expect("array size is invalid"),
6768
);
6869
let parent_item = cx.tcx.hir.get_parent(e.id);
6970
let parent_def_id = cx.tcx.hir.local_def_id(parent_item);
7071
let substs = Substs::identity_for_item(cx.tcx, parent_def_id);
7172
let constcx = ConstContext::new(cx.tcx, cx.param_env.and(substs), cx.tables);
7273

7374
// Index is a constant uint
74-
let const_index = constcx.eval(index);
75-
if let Ok(ConstVal::Integral(const_index)) = const_index {
76-
if size <= const_index {
77-
utils::span_lint(cx, OUT_OF_BOUNDS_INDEXING, e.span, "const index is out of bounds");
78-
}
75+
if let Ok(const_index) = constcx.eval(index) {
76+
if let ConstVal::Integral(const_index) = const_index.val {
77+
if size <= const_index {
78+
utils::span_lint(cx, OUT_OF_BOUNDS_INDEXING, e.span, "const index is out of bounds");
79+
}
7980

80-
return;
81+
return;
82+
}
8183
}
8284

8385
// Index is a constant range
@@ -112,19 +114,19 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ArrayIndexing {
112114
/// Returns an option containing a tuple with the start and end (exclusive) of
113115
/// the range.
114116
fn to_const_range(
115-
start: &Option<Option<ConstVal>>,
116-
end: &Option<Option<ConstVal>>,
117+
start: &Option<Option<&ty::Const>>,
118+
end: &Option<Option<&ty::Const>>,
117119
limits: RangeLimits,
118120
array_size: ConstInt,
119121
) -> Option<(ConstInt, ConstInt)> {
120122
let start = match *start {
121-
Some(Some(ConstVal::Integral(x))) => x,
123+
Some(Some(&ty::Const { val: ConstVal::Integral(x), .. })) => x,
122124
Some(_) => return None,
123125
None => ConstInt::U8(0),
124126
};
125127

126128
let end = match *end {
127-
Some(Some(ConstVal::Integral(x))) => if limits == RangeLimits::Closed {
129+
Some(Some(&ty::Const { val: ConstVal::Integral(x), .. })) => if limits == RangeLimits::Closed {
128130
match x {
129131
ConstInt::U8(_) => (x + ConstInt::U8(1)),
130132
ConstInt::U16(_) => (x + ConstInt::U16(1)),

clippy_lints/src/consts.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use std::mem;
1414
use std::rc::Rc;
1515
use syntax::ast::{FloatTy, LitKind, StrStyle};
1616
use syntax::ptr::P;
17+
use utils::const_to_u64;
1718

1819
#[derive(Debug, Copy, Clone)]
1920
pub enum FloatWidth {
@@ -49,7 +50,7 @@ pub enum Constant {
4950
/// an array of constants
5051
Vec(Vec<Constant>),
5152
/// also an array, but with only one constant, repeated N times
52-
Repeat(Box<Constant>, usize),
53+
Repeat(Box<Constant>, u64),
5354
/// a tuple of constants
5455
Tuple(Vec<Constant>),
5556
}
@@ -175,10 +176,10 @@ pub fn lit_to_constant<'a, 'tcx>(lit: &LitKind, tcx: TyCtxt<'a, 'tcx, 'tcx>, mut
175176
LitKind::Char(c) => Constant::Char(c),
176177
LitKind::Int(n, hint) => match (&ty.sty, hint) {
177178
(&ty::TyInt(ity), _) | (_, Signed(ity)) => {
178-
Constant::Int(ConstInt::new_signed_truncating(n as i128, ity, tcx.sess.target.int_type))
179+
Constant::Int(ConstInt::new_signed_truncating(n as i128, ity, tcx.sess.target.isize_ty))
179180
},
180181
(&ty::TyUint(uty), _) | (_, Unsigned(uty)) => {
181-
Constant::Int(ConstInt::new_unsigned_truncating(n as u128, uty, tcx.sess.target.uint_type))
182+
Constant::Int(ConstInt::new_unsigned_truncating(n as u128, uty, tcx.sess.target.usize_ty))
182183
},
183184
_ => bug!(),
184185
},
@@ -249,7 +250,7 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
249250
ExprTup(ref tup) => self.multi(tup).map(Constant::Tuple),
250251
ExprRepeat(ref value, _) => {
251252
let n = match self.tables.expr_ty(e).sty {
252-
ty::TyArray(_, n) => n,
253+
ty::TyArray(_, n) => const_to_u64(n),
253254
_ => span_bug!(e.span, "typeck error"),
254255
};
255256
self.expr(value).map(|v| Constant::Repeat(Box::new(v), n))

clippy_lints/src/derive.rs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -143,17 +143,8 @@ fn check_copy_clone<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, item: &Item, trait_ref
143143
// Some types are not Clone by default but could be cloned “by hand” if necessary
144144
ty::TyAdt(def, substs) => for variant in &def.variants {
145145
for field in &variant.fields {
146-
match field.ty(cx.tcx, substs).sty {
147-
ty::TyArray(_, size) if size > 32 => {
148-
return;
149-
},
150-
ty::TyFnPtr(..) => {
151-
return;
152-
},
153-
ty::TyTuple(tys, _) if tys.len() > 12 => {
154-
return;
155-
},
156-
_ => (),
146+
if let ty::TyFnDef(..) = field.ty(cx.tcx, substs).sty {
147+
return;
157148
}
158149
}
159150
},

clippy_lints/src/enum_clike.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnportableVariant {
5555
.at(expr.span)
5656
.const_eval(param_env.and((did, substs)))
5757
{
58-
Ok(ConstVal::Integral(Usize(Us64(i)))) => u64::from(i as u32) != i,
59-
Ok(ConstVal::Integral(Isize(Is64(i)))) => i64::from(i as i32) != i,
58+
Ok(&ty::Const { val: ConstVal::Integral(Usize(Us64(i))), .. }) => u64::from(i as u32) != i,
59+
Ok(&ty::Const { val: ConstVal::Integral(Isize(Is64(i))), .. }) => i64::from(i as i32) != i,
6060
_ => false,
6161
};
6262
if bad {

clippy_lints/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#![feature(slice_patterns)]
99
#![feature(stmt_expr_attributes)]
1010
#![feature(conservative_impl_trait)]
11+
#![feature(inclusive_range_syntax, range_contains)]
1112
#![allow(unknown_lints, indexing_slicing, shadow_reuse, missing_docs_in_private_items)]
1213

1314
#[macro_use]

clippy_lints/src/loops.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use rustc_const_eval::ConstContext;
1313
use std::collections::{HashMap, HashSet};
1414
use syntax::ast;
1515
use utils::sugg;
16+
use utils::const_to_u64;
1617

1718
use utils::{get_enclosing_block, get_parent_expr, higher, in_external_macro, is_integer_literal, is_refutable,
1819
last_path_segment, match_trait_method, match_type, multispan_sugg, snippet, snippet_opt,
@@ -969,7 +970,7 @@ fn is_len_call(expr: &Expr, var: &Name) -> bool {
969970
false
970971
}
971972

972-
fn check_for_loop_reverse_range(cx: &LateContext, arg: &Expr, expr: &Expr) {
973+
fn check_for_loop_reverse_range<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, arg: &'tcx Expr, expr: &'tcx Expr) {
973974
// if this for loop is iterating over a two-sided range...
974975
if let Some(higher::Range {
975976
start: Some(start),
@@ -989,7 +990,7 @@ fn check_for_loop_reverse_range(cx: &LateContext, arg: &Expr, expr: &Expr) {
989990
// who think that this will iterate from the larger value to the
990991
// smaller value.
991992
let (sup, eq) = match (start_idx, end_idx) {
992-
(ConstVal::Integral(start_idx), ConstVal::Integral(end_idx)) => {
993+
(&ty::Const{ val: ConstVal::Integral(start_idx), .. }, &ty::Const{ val: ConstVal::Integral(end_idx), .. }) => {
993994
(start_idx > end_idx, start_idx == end_idx)
994995
},
995996
_ => (false, false),
@@ -1461,7 +1462,7 @@ fn is_ref_iterable_type(cx: &LateContext, e: &Expr) -> bool {
14611462
fn is_iterable_array(ty: Ty) -> bool {
14621463
// IntoIterator is currently only implemented for array sizes <= 32 in rustc
14631464
match ty.sty {
1464-
ty::TyArray(_, 0...32) => true,
1465+
ty::TyArray(_, n) => (0...32).contains(const_to_u64(n)),
14651466
_ => false,
14661467
}
14671468
}

clippy_lints/src/matches.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ fn check_match_bool(cx: &LateContext, ex: &Expr, arms: &[Arm], expr: &Expr) {
318318
}
319319
}
320320

321-
fn check_overlapping_arms(cx: &LateContext, ex: &Expr, arms: &[Arm]) {
321+
fn check_overlapping_arms<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, ex: &'tcx Expr, arms: &'tcx [Arm]) {
322322
if arms.len() >= 2 && cx.tables.expr_ty(ex).is_integral() {
323323
let ranges = all_ranges(cx, arms, ex.id);
324324
let type_ranges = type_ranges(&ranges);
@@ -411,7 +411,7 @@ fn check_match_ref_pats(cx: &LateContext, ex: &Expr, arms: &[Arm], source: Match
411411
}
412412

413413
/// Get all arms that are unbounded `PatRange`s.
414-
fn all_ranges<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, arms: &[Arm], id: NodeId) -> Vec<SpannedRange<ConstVal<'tcx>>> {
414+
fn all_ranges<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, arms: &'tcx [Arm], id: NodeId) -> Vec<SpannedRange<&'tcx ty::Const<'tcx>>> {
415415
let parent_item = cx.tcx.hir.get_parent(id);
416416
let parent_def_id = cx.tcx.hir.local_def_id(parent_item);
417417
let substs = Substs::identity_for_item(cx.tcx, parent_def_id);
@@ -444,7 +444,7 @@ fn all_ranges<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, arms: &[Arm], id: NodeId) ->
444444
let PatKind::Lit(ref value) = pat.node,
445445
let Ok(value) = constcx.eval(value)
446446
], {
447-
return Some(SpannedRange { span: pat.span, node: (value.clone(), Bound::Included(value)) });
447+
return Some(SpannedRange { span: pat.span, node: (value, Bound::Included(value)) });
448448
}}
449449

450450
None
@@ -464,19 +464,19 @@ type TypedRanges = Vec<SpannedRange<ConstInt>>;
464464
/// Get all `Int` ranges or all `Uint` ranges. Mixed types are an error anyway
465465
/// and other types than
466466
/// `Uint` and `Int` probably don't make sense.
467-
fn type_ranges(ranges: &[SpannedRange<ConstVal>]) -> TypedRanges {
467+
fn type_ranges(ranges: &[SpannedRange<&ty::Const>]) -> TypedRanges {
468468
ranges
469469
.iter()
470470
.filter_map(|range| match range.node {
471-
(ConstVal::Integral(start), Bound::Included(ConstVal::Integral(end))) => Some(SpannedRange {
471+
(&ty::Const { val: ConstVal::Integral(start), .. }, Bound::Included(&ty::Const { val: ConstVal::Integral(end), .. })) => Some(SpannedRange {
472472
span: range.span,
473473
node: (start, Bound::Included(end)),
474474
}),
475-
(ConstVal::Integral(start), Bound::Excluded(ConstVal::Integral(end))) => Some(SpannedRange {
475+
(&ty::Const { val: ConstVal::Integral(start), .. }, Bound::Excluded(&ty::Const { val: ConstVal::Integral(end), .. })) => Some(SpannedRange {
476476
span: range.span,
477477
node: (start, Bound::Excluded(end)),
478478
}),
479-
(ConstVal::Integral(start), Bound::Unbounded) => Some(SpannedRange {
479+
(&ty::Const { val: ConstVal::Integral(start), .. }, Bound::Unbounded) => Some(SpannedRange {
480480
span: range.span,
481481
node: (start, Bound::Unbounded),
482482
}),

clippy_lints/src/methods.rs

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use utils::{get_trait_def_id, implements_trait, in_external_macro, in_macro, is_
1414
span_lint_and_sugg, span_lint_and_then, span_note_and_lint, walk_ptrs_ty, walk_ptrs_ty_depth};
1515
use utils::paths;
1616
use utils::sugg;
17+
use utils::const_to_u64;
1718

1819
#[derive(Clone)]
1920
pub struct Pass;
@@ -1049,7 +1050,7 @@ fn derefs_to_slice(cx: &LateContext, expr: &hir::Expr, ty: Ty) -> Option<sugg::S
10491050
ty::TySlice(_) => true,
10501051
ty::TyAdt(def, _) if def.is_box() => may_slice(cx, ty.boxed_ty()),
10511052
ty::TyAdt(..) => match_type(cx, ty, &paths::VEC),
1052-
ty::TyArray(_, size) => size < 32,
1053+
ty::TyArray(_, size) => const_to_u64(size) < 32,
10531054
ty::TyRef(_, ty::TypeAndMut { ty: inner, .. }) => may_slice(cx, inner),
10541055
_ => false,
10551056
}
@@ -1155,7 +1156,7 @@ fn lint_map_unwrap_or(cx: &LateContext, expr: &hir::Expr, map_args: &[hir::Expr]
11551156
}
11561157

11571158
/// lint use of `map().unwrap_or_else()` for `Option`s
1158-
fn lint_map_unwrap_or_else(cx: &LateContext, expr: &hir::Expr, map_args: &[hir::Expr], unwrap_args: &[hir::Expr]) {
1159+
fn lint_map_unwrap_or_else<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx hir::Expr, map_args: &'tcx [hir::Expr], unwrap_args: &'tcx [hir::Expr]) {
11591160
// lint if the caller of `map()` is an `Option`
11601161
if match_type(cx, cx.tables.expr_ty(&map_args[0]), &paths::OPTION) {
11611162
// lint message
@@ -1188,7 +1189,7 @@ fn lint_map_unwrap_or_else(cx: &LateContext, expr: &hir::Expr, map_args: &[hir::
11881189
}
11891190

11901191
/// lint use of `filter().next()` for `Iterators`
1191-
fn lint_filter_next(cx: &LateContext, expr: &hir::Expr, filter_args: &[hir::Expr]) {
1192+
fn lint_filter_next<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx hir::Expr, filter_args: &'tcx [hir::Expr]) {
11921193
// lint if caller of `.filter().next()` is an Iterator
11931194
if match_trait_method(cx, expr, &paths::ITERATOR) {
11941195
let msg = "called `filter(p).next()` on an `Iterator`. This is more succinctly expressed by calling \
@@ -1211,7 +1212,7 @@ fn lint_filter_next(cx: &LateContext, expr: &hir::Expr, filter_args: &[hir::Expr
12111212
}
12121213

12131214
/// lint use of `filter().map()` for `Iterators`
1214-
fn lint_filter_map(cx: &LateContext, expr: &hir::Expr, _filter_args: &[hir::Expr], _map_args: &[hir::Expr]) {
1215+
fn lint_filter_map<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx hir::Expr, _filter_args: &'tcx [hir::Expr], _map_args: &'tcx [hir::Expr]) {
12151216
// lint if caller of `.filter().map()` is an Iterator
12161217
if match_trait_method(cx, expr, &paths::ITERATOR) {
12171218
let msg = "called `filter(p).map(q)` on an `Iterator`. \
@@ -1221,7 +1222,7 @@ fn lint_filter_map(cx: &LateContext, expr: &hir::Expr, _filter_args: &[hir::Expr
12211222
}
12221223

12231224
/// lint use of `filter().map()` for `Iterators`
1224-
fn lint_filter_map_map(cx: &LateContext, expr: &hir::Expr, _filter_args: &[hir::Expr], _map_args: &[hir::Expr]) {
1225+
fn lint_filter_map_map<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx hir::Expr, _filter_args: &'tcx [hir::Expr], _map_args: &'tcx [hir::Expr]) {
12251226
// lint if caller of `.filter().map()` is an Iterator
12261227
if match_trait_method(cx, expr, &paths::ITERATOR) {
12271228
let msg = "called `filter_map(p).map(q)` on an `Iterator`. \
@@ -1231,7 +1232,7 @@ fn lint_filter_map_map(cx: &LateContext, expr: &hir::Expr, _filter_args: &[hir::
12311232
}
12321233

12331234
/// lint use of `filter().flat_map()` for `Iterators`
1234-
fn lint_filter_flat_map(cx: &LateContext, expr: &hir::Expr, _filter_args: &[hir::Expr], _map_args: &[hir::Expr]) {
1235+
fn lint_filter_flat_map<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx hir::Expr, _filter_args: &'tcx [hir::Expr], _map_args: &'tcx [hir::Expr]) {
12351236
// lint if caller of `.filter().flat_map()` is an Iterator
12361237
if match_trait_method(cx, expr, &paths::ITERATOR) {
12371238
let msg = "called `filter(p).flat_map(q)` on an `Iterator`. \
@@ -1242,7 +1243,7 @@ fn lint_filter_flat_map(cx: &LateContext, expr: &hir::Expr, _filter_args: &[hir:
12421243
}
12431244

12441245
/// lint use of `filter_map().flat_map()` for `Iterators`
1245-
fn lint_filter_map_flat_map(cx: &LateContext, expr: &hir::Expr, _filter_args: &[hir::Expr], _map_args: &[hir::Expr]) {
1246+
fn lint_filter_map_flat_map<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx hir::Expr, _filter_args: &'tcx [hir::Expr], _map_args: &'tcx [hir::Expr]) {
12461247
// lint if caller of `.filter_map().flat_map()` is an Iterator
12471248
if match_trait_method(cx, expr, &paths::ITERATOR) {
12481249
let msg = "called `filter_map(p).flat_map(q)` on an `Iterator`. \
@@ -1253,12 +1254,12 @@ fn lint_filter_map_flat_map(cx: &LateContext, expr: &hir::Expr, _filter_args: &[
12531254
}
12541255

12551256
/// lint searching an Iterator followed by `is_some()`
1256-
fn lint_search_is_some(
1257-
cx: &LateContext,
1258-
expr: &hir::Expr,
1257+
fn lint_search_is_some<'a, 'tcx>(
1258+
cx: &LateContext<'a, 'tcx>,
1259+
expr: &'tcx hir::Expr,
12591260
search_method: &str,
1260-
search_args: &[hir::Expr],
1261-
is_some_args: &[hir::Expr],
1261+
search_args: &'tcx [hir::Expr],
1262+
is_some_args: &'tcx [hir::Expr],
12621263
) {
12631264
// lint if caller of search is an Iterator
12641265
if match_trait_method(cx, &is_some_args[0], &paths::ITERATOR) {
@@ -1285,7 +1286,7 @@ fn lint_search_is_some(
12851286
}
12861287

12871288
/// Checks for the `CHARS_NEXT_CMP` lint.
1288-
fn lint_chars_next(cx: &LateContext, expr: &hir::Expr, chain: &hir::Expr, other: &hir::Expr, eq: bool) -> bool {
1289+
fn lint_chars_next<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx hir::Expr, chain: &'tcx hir::Expr, other: &'tcx hir::Expr, eq: bool) -> bool {
12891290
if_let_chain! {[
12901291
let Some(args) = method_chain_args(chain, &["chars", "next"]),
12911292
let hir::ExprCall(ref fun, ref arg_char) = other.node,
@@ -1317,11 +1318,11 @@ fn lint_chars_next(cx: &LateContext, expr: &hir::Expr, chain: &hir::Expr, other:
13171318
}
13181319

13191320
/// lint for length-1 `str`s for methods in `PATTERN_METHODS`
1320-
fn lint_single_char_pattern(cx: &LateContext, expr: &hir::Expr, arg: &hir::Expr) {
1321+
fn lint_single_char_pattern<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx hir::Expr, arg: &'tcx hir::Expr) {
13211322
let parent_item = cx.tcx.hir.get_parent(arg.id);
13221323
let parent_def_id = cx.tcx.hir.local_def_id(parent_item);
13231324
let substs = Substs::identity_for_item(cx.tcx, parent_def_id);
1324-
if let Ok(ConstVal::Str(r)) = ConstContext::new(cx.tcx, cx.param_env.and(substs), cx.tables).eval(arg) {
1325+
if let Ok(&ty::Const { val: ConstVal::Str(r), .. }) = ConstContext::new(cx.tcx, cx.param_env.and(substs), cx.tables).eval(arg) {
13251326
if r.len() == 1 {
13261327
let hint = snippet(cx, expr.span, "..").replace(&format!("\"{}\"", r), &format!("'{}'", r));
13271328
span_lint_and_then(

0 commit comments

Comments
 (0)