Skip to content

Commit 11ca07c

Browse files
authored
Merge pull request #1360 from Manishearth/rustup
Rustup to *rustc 1.15.0-nightly (3bf2be9 2016-11-22)* and bump to 0.0.102
2 parents 9717b95 + 9a92ed4 commit 11ca07c

File tree

16 files changed

+42
-65
lines changed

16 files changed

+42
-65
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.102 — date
5+
* Update to *rustc 1.15.0-nightly (3bf2be9ce 2016-11-22)*
6+
47
## 0.0.101 — 2016-11-23
58
* Update to *rustc 1.15.0-nightly (7b3eeea22 2016-11-21)*
69
* New lint: [`string_extend_chars`]

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.101"
3+
version = "0.0.102"
44
authors = [
55
"Manish Goregaokar <[email protected]>",
66
"Andre Bogus <[email protected]>",
@@ -25,7 +25,7 @@ test = false
2525

2626
[dependencies]
2727
# begin automatic update
28-
clippy_lints = { version = "0.0.101", path = "clippy_lints" }
28+
clippy_lints = { version = "0.0.102", path = "clippy_lints" }
2929
# end automatic update
3030

3131
[dev-dependencies]

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.101"
4+
version = "0.0.102"
55
# end automatic update
66
authors = [
77
"Manish Goregaokar <[email protected]>",

clippy_lints/src/consts.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use std::cmp::Ordering::{self, Equal};
99
use std::cmp::PartialOrd;
1010
use std::hash::{Hash, Hasher};
1111
use std::mem;
12-
use std::ops::Deref;
1312
use std::rc::Rc;
1413
use syntax::ast::{FloatTy, LitIntType, LitKind, StrStyle, UintTy, IntTy};
1514
use syntax::ptr::P;
@@ -279,7 +278,7 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
279278

280279
/// create `Some(Vec![..])` of all constants, unless there is any
281280
/// non-constant part
282-
fn multi<E: Deref<Target = Expr> + Sized>(&mut self, vec: &[E]) -> Option<Vec<Constant>> {
281+
fn multi(&mut self, vec: &[Expr]) -> Option<Vec<Constant>> {
283282
vec.iter()
284283
.map(|elem| self.expr(elem))
285284
.collect::<Option<_>>()

clippy_lints/src/drop_ref.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ impl LateLintPass for Pass {
4444
if args.len() != 1 {
4545
return;
4646
}
47-
check_drop_arg(cx, expr.span, &*args[0]);
47+
check_drop_arg(cx, expr.span, &args[0]);
4848
}
4949
}
5050
}

clippy_lints/src/entry.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ impl<'a, 'tcx, 'v, 'b> Visitor<'v> for InsertVisitor<'a, 'tcx, 'b> {
117117
let ExprMethodCall(ref name, _, ref params) = expr.node,
118118
params.len() == 3,
119119
&*name.node.as_str() == "insert",
120-
get_item_name(self.cx, self.map) == get_item_name(self.cx, &*params[0]),
120+
get_item_name(self.cx, self.map) == get_item_name(self.cx, &params[0]),
121121
SpanlessEq::new(self.cx).eq_expr(self.key, &params[1])
122122
], {
123123
span_lint_and_then(self.cx, MAP_ENTRY, self.span,

clippy_lints/src/len_zero.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use rustc::ty;
44
use rustc::hir::*;
55
use syntax::ast::{Lit, LitKind, Name};
66
use syntax::codemap::{Span, Spanned};
7-
use syntax::ptr::P;
87
use utils::{get_item_name, in_macro, snippet, span_lint, span_lint_and_then, walk_ptrs_ty};
98

109
/// **What it does:** Checks for getting the length of something via `.len()`
@@ -170,7 +169,7 @@ fn check_cmp(cx: &LateContext, span: Span, left: &Expr, right: &Expr, op: &str)
170169
}
171170
}
172171

173-
fn check_len_zero(cx: &LateContext, span: Span, name: &Name, args: &[P<Expr>], lit: &Lit, op: &str) {
172+
fn check_len_zero(cx: &LateContext, span: Span, name: &Name, args: &[Expr], lit: &Lit, op: &str) {
174173
if let Spanned { node: LitKind::Int(0, _), .. } = *lit {
175174
if &*name.as_str() == "len" && args.len() == 1 && has_is_empty(cx, &args[0]) {
176175
span_lint_and_then(cx, LEN_ZERO, span, "length comparison to zero", |db| {

clippy_lints/src/methods.rs

Lines changed: 19 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@ use rustc_const_eval::eval_const_expr_partial;
88
use std::borrow::Cow;
99
use std::fmt;
1010
use syntax::codemap::Span;
11-
use syntax::ptr::P;
1211
use utils::{get_trait_def_id, implements_trait, in_external_macro, in_macro, is_copy, match_path,
1312
match_trait_method, match_type, method_chain_args, return_ty, same_tys, snippet,
1413
span_lint, span_lint_and_then, span_note_and_lint, walk_ptrs_ty, walk_ptrs_ty_depth};
15-
use utils::MethodArgs;
1614
use utils::paths;
1715
use utils::sugg;
1816

@@ -693,7 +691,7 @@ impl LateLintPass for Pass {
693691
}
694692

695693
/// Checks for the `OR_FUN_CALL` lint.
696-
fn lint_or_fun_call(cx: &LateContext, expr: &hir::Expr, name: &str, args: &[P<hir::Expr>]) {
694+
fn lint_or_fun_call(cx: &LateContext, expr: &hir::Expr, name: &str, args: &[hir::Expr]) {
697695
/// Check for `unwrap_or(T::new())` or `unwrap_or(T::default())`.
698696
fn check_unwrap_or_default(cx: &LateContext, name: &str, fun: &hir::Expr, self_expr: &hir::Expr, arg: &hir::Expr,
699697
or_has_args: bool, span: Span)
@@ -825,7 +823,7 @@ fn lint_clone_on_copy(cx: &LateContext, expr: &hir::Expr, arg: &hir::Expr, arg_t
825823
}
826824
}
827825

828-
fn lint_vec_extend(cx: &LateContext, expr: &hir::Expr, args: &MethodArgs) {
826+
fn lint_vec_extend(cx: &LateContext, expr: &hir::Expr, args: &[hir::Expr]) {
829827
let arg_ty = cx.tcx.tables().expr_ty(&args[1]);
830828
if let Some(slice) = derefs_to_slice(cx, &args[1], arg_ty) {
831829
span_lint_and_then(cx, EXTEND_FROM_SLICE, expr.span, "use of `extend` to extend a Vec by a slice", |db| {
@@ -838,7 +836,7 @@ fn lint_vec_extend(cx: &LateContext, expr: &hir::Expr, args: &MethodArgs) {
838836
}
839837
}
840838

841-
fn lint_string_extend(cx: &LateContext, expr: &hir::Expr, args: &MethodArgs) {
839+
fn lint_string_extend(cx: &LateContext, expr: &hir::Expr, args: &[hir::Expr]) {
842840
let arg = &args[1];
843841
if let Some(arglists) = method_chain_args(arg, &["chars"]) {
844842
let target = &arglists[0][0];
@@ -866,7 +864,7 @@ fn lint_string_extend(cx: &LateContext, expr: &hir::Expr, args: &MethodArgs) {
866864
}
867865
}
868866

869-
fn lint_extend(cx: &LateContext, expr: &hir::Expr, args: &MethodArgs) {
867+
fn lint_extend(cx: &LateContext, expr: &hir::Expr, args: &[hir::Expr]) {
870868
let (obj_ty, _) = walk_ptrs_ty_depth(cx.tcx.tables().expr_ty(&args[0]));
871869
if match_type(cx, obj_ty, &paths::VEC) {
872870
lint_vec_extend(cx, expr, args);
@@ -891,9 +889,7 @@ fn lint_cstring_as_ptr(cx: &LateContext, expr: &hir::Expr, new: &hir::Expr, unwr
891889
}}
892890
}
893891

894-
#[allow(ptr_arg)]
895-
// Type of MethodArgs is potentially a Vec
896-
fn lint_iter_nth(cx: &LateContext, expr: &hir::Expr, iter_args: &MethodArgs, is_mut: bool){
892+
fn lint_iter_nth(cx: &LateContext, expr: &hir::Expr, iter_args: &[hir::Expr], is_mut: bool){
897893
let mut_str = if is_mut { "_mut" } else {""};
898894
let caller_type = if derefs_to_slice(cx, &iter_args[0], cx.tcx.tables().expr_ty(&iter_args[0])).is_some() {
899895
"slice"
@@ -917,7 +913,7 @@ fn lint_iter_nth(cx: &LateContext, expr: &hir::Expr, iter_args: &MethodArgs, is_
917913
);
918914
}
919915

920-
fn lint_get_unwrap(cx: &LateContext, expr: &hir::Expr, get_args: &MethodArgs, is_mut: bool) {
916+
fn lint_get_unwrap(cx: &LateContext, expr: &hir::Expr, get_args: &[hir::Expr], is_mut: bool) {
921917
// Note: we don't want to lint `get_mut().unwrap` for HashMap or BTreeMap,
922918
// because they do not implement `IndexMut`
923919
let expr_ty = cx.tcx.tables().expr_ty(&get_args[0]);
@@ -980,7 +976,7 @@ fn derefs_to_slice(cx: &LateContext, expr: &hir::Expr, ty: ty::Ty) -> Option<sug
980976

981977
if let hir::ExprMethodCall(name, _, ref args) = expr.node {
982978
if &*name.node.as_str() == "iter" && may_slice(cx, cx.tcx.tables().expr_ty(&args[0])) {
983-
sugg::Sugg::hir_opt(cx, &*args[0]).map(|sugg| {
979+
sugg::Sugg::hir_opt(cx, &args[0]).map(|sugg| {
984980
sugg.addr()
985981
})
986982
} else {
@@ -1002,10 +998,8 @@ fn derefs_to_slice(cx: &LateContext, expr: &hir::Expr, ty: ty::Ty) -> Option<sug
1002998
}
1003999
}
10041000

1005-
#[allow(ptr_arg)]
1006-
// Type of MethodArgs is potentially a Vec
10071001
/// lint use of `unwrap()` for `Option`s and `Result`s
1008-
fn lint_unwrap(cx: &LateContext, expr: &hir::Expr, unwrap_args: &MethodArgs) {
1002+
fn lint_unwrap(cx: &LateContext, expr: &hir::Expr, unwrap_args: &[hir::Expr]) {
10091003
let (obj_ty, _) = walk_ptrs_ty_depth(cx.tcx.tables().expr_ty(&unwrap_args[0]));
10101004

10111005
let mess = if match_type(cx, obj_ty, &paths::OPTION) {
@@ -1028,10 +1022,8 @@ fn lint_unwrap(cx: &LateContext, expr: &hir::Expr, unwrap_args: &MethodArgs) {
10281022
}
10291023
}
10301024

1031-
#[allow(ptr_arg)]
1032-
// Type of MethodArgs is potentially a Vec
10331025
/// lint use of `ok().expect()` for `Result`s
1034-
fn lint_ok_expect(cx: &LateContext, expr: &hir::Expr, ok_args: &MethodArgs) {
1026+
fn lint_ok_expect(cx: &LateContext, expr: &hir::Expr, ok_args: &[hir::Expr]) {
10351027
// lint if the caller of `ok()` is a `Result`
10361028
if match_type(cx, cx.tcx.tables().expr_ty(&ok_args[0]), &paths::RESULT) {
10371029
let result_type = cx.tcx.tables().expr_ty(&ok_args[0]);
@@ -1046,10 +1038,8 @@ fn lint_ok_expect(cx: &LateContext, expr: &hir::Expr, ok_args: &MethodArgs) {
10461038
}
10471039
}
10481040

1049-
#[allow(ptr_arg)]
1050-
// Type of MethodArgs is potentially a Vec
10511041
/// lint use of `map().unwrap_or()` for `Option`s
1052-
fn lint_map_unwrap_or(cx: &LateContext, expr: &hir::Expr, map_args: &MethodArgs, unwrap_args: &MethodArgs) {
1042+
fn lint_map_unwrap_or(cx: &LateContext, expr: &hir::Expr, map_args: &[hir::Expr], unwrap_args: &[hir::Expr]) {
10531043
// lint if the caller of `map()` is an `Option`
10541044
if match_type(cx, cx.tcx.tables().expr_ty(&map_args[0]), &paths::OPTION) {
10551045
// lint message
@@ -1077,10 +1067,8 @@ fn lint_map_unwrap_or(cx: &LateContext, expr: &hir::Expr, map_args: &MethodArgs,
10771067
}
10781068
}
10791069

1080-
#[allow(ptr_arg)]
1081-
// Type of MethodArgs is potentially a Vec
10821070
/// lint use of `map().unwrap_or_else()` for `Option`s
1083-
fn lint_map_unwrap_or_else(cx: &LateContext, expr: &hir::Expr, map_args: &MethodArgs, unwrap_args: &MethodArgs) {
1071+
fn lint_map_unwrap_or_else(cx: &LateContext, expr: &hir::Expr, map_args: &[hir::Expr], unwrap_args: &[hir::Expr]) {
10841072
// lint if the caller of `map()` is an `Option`
10851073
if match_type(cx, cx.tcx.tables().expr_ty(&map_args[0]), &paths::OPTION) {
10861074
// lint message
@@ -1108,10 +1096,8 @@ fn lint_map_unwrap_or_else(cx: &LateContext, expr: &hir::Expr, map_args: &Method
11081096
}
11091097
}
11101098

1111-
#[allow(ptr_arg)]
1112-
// Type of MethodArgs is potentially a Vec
11131099
/// lint use of `filter().next()` for `Iterators`
1114-
fn lint_filter_next(cx: &LateContext, expr: &hir::Expr, filter_args: &MethodArgs) {
1100+
fn lint_filter_next(cx: &LateContext, expr: &hir::Expr, filter_args: &[hir::Expr]) {
11151101
// lint if caller of `.filter().next()` is an Iterator
11161102
if match_trait_method(cx, expr, &paths::ITERATOR) {
11171103
let msg = "called `filter(p).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(p)` \
@@ -1131,9 +1117,8 @@ fn lint_filter_next(cx: &LateContext, expr: &hir::Expr, filter_args: &MethodArgs
11311117
}
11321118
}
11331119

1134-
// Type of MethodArgs is potentially a Vec
11351120
/// lint use of `filter().map()` for `Iterators`
1136-
fn lint_filter_map(cx: &LateContext, expr: &hir::Expr, _filter_args: &MethodArgs, _map_args: &MethodArgs) {
1121+
fn lint_filter_map(cx: &LateContext, expr: &hir::Expr, _filter_args: &[hir::Expr], _map_args: &[hir::Expr]) {
11371122
// lint if caller of `.filter().map()` is an Iterator
11381123
if match_trait_method(cx, expr, &paths::ITERATOR) {
11391124
let msg = "called `filter(p).map(q)` on an `Iterator`. \
@@ -1142,9 +1127,8 @@ fn lint_filter_map(cx: &LateContext, expr: &hir::Expr, _filter_args: &MethodArgs
11421127
}
11431128
}
11441129

1145-
// Type of MethodArgs is potentially a Vec
11461130
/// lint use of `filter().map()` for `Iterators`
1147-
fn lint_filter_map_map(cx: &LateContext, expr: &hir::Expr, _filter_args: &MethodArgs, _map_args: &MethodArgs) {
1131+
fn lint_filter_map_map(cx: &LateContext, expr: &hir::Expr, _filter_args: &[hir::Expr], _map_args: &[hir::Expr]) {
11481132
// lint if caller of `.filter().map()` is an Iterator
11491133
if match_trait_method(cx, expr, &paths::ITERATOR) {
11501134
let msg = "called `filter_map(p).map(q)` on an `Iterator`. \
@@ -1153,9 +1137,8 @@ fn lint_filter_map_map(cx: &LateContext, expr: &hir::Expr, _filter_args: &Method
11531137
}
11541138
}
11551139

1156-
// Type of MethodArgs is potentially a Vec
11571140
/// lint use of `filter().flat_map()` for `Iterators`
1158-
fn lint_filter_flat_map(cx: &LateContext, expr: &hir::Expr, _filter_args: &MethodArgs, _map_args: &MethodArgs) {
1141+
fn lint_filter_flat_map(cx: &LateContext, expr: &hir::Expr, _filter_args: &[hir::Expr], _map_args: &[hir::Expr]) {
11591142
// lint if caller of `.filter().flat_map()` is an Iterator
11601143
if match_trait_method(cx, expr, &paths::ITERATOR) {
11611144
let msg = "called `filter(p).flat_map(q)` on an `Iterator`. \
@@ -1165,9 +1148,8 @@ fn lint_filter_flat_map(cx: &LateContext, expr: &hir::Expr, _filter_args: &Metho
11651148
}
11661149
}
11671150

1168-
// Type of MethodArgs is potentially a Vec
11691151
/// lint use of `filter_map().flat_map()` for `Iterators`
1170-
fn lint_filter_map_flat_map(cx: &LateContext, expr: &hir::Expr, _filter_args: &MethodArgs, _map_args: &MethodArgs) {
1152+
fn lint_filter_map_flat_map(cx: &LateContext, expr: &hir::Expr, _filter_args: &[hir::Expr], _map_args: &[hir::Expr]) {
11711153
// lint if caller of `.filter_map().flat_map()` is an Iterator
11721154
if match_trait_method(cx, expr, &paths::ITERATOR) {
11731155
let msg = "called `filter_map(p).flat_map(q)` on an `Iterator`. \
@@ -1177,13 +1159,11 @@ fn lint_filter_map_flat_map(cx: &LateContext, expr: &hir::Expr, _filter_args: &M
11771159
}
11781160
}
11791161

1180-
#[allow(ptr_arg)]
1181-
// Type of MethodArgs is potentially a Vec
11821162
/// lint searching an Iterator followed by `is_some()`
1183-
fn lint_search_is_some(cx: &LateContext, expr: &hir::Expr, search_method: &str, search_args: &MethodArgs,
1184-
is_some_args: &MethodArgs) {
1163+
fn lint_search_is_some(cx: &LateContext, expr: &hir::Expr, search_method: &str, search_args: &[hir::Expr],
1164+
is_some_args: &[hir::Expr]) {
11851165
// lint if caller of search is an Iterator
1186-
if match_trait_method(cx, &*is_some_args[0], &paths::ITERATOR) {
1166+
if match_trait_method(cx, &is_some_args[0], &paths::ITERATOR) {
11871167
let msg = format!("called `is_some()` after searching an `Iterator` with {}. This is more succinctly expressed \
11881168
by calling `any()`.",
11891169
search_method);

clippy_lints/src/minmax.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use consts::{Constant, constant_simple};
22
use rustc::lint::*;
33
use rustc::hir::*;
44
use std::cmp::{PartialOrd, Ordering};
5-
use syntax::ptr::P;
65
use utils::{match_def_path, paths, span_lint};
76

87
/// **What it does:** Checks for expressions where `std::cmp::min` and `max` are
@@ -80,7 +79,7 @@ fn min_max<'a>(cx: &LateContext, expr: &'a Expr) -> Option<(MinMax, Constant, &'
8079
}
8180
}
8281

83-
fn fetch_const(args: &[P<Expr>], m: MinMax) -> Option<(MinMax, Constant, &Expr)> {
82+
fn fetch_const(args: &[Expr], m: MinMax) -> Option<(MinMax, Constant, &Expr)> {
8483
if args.len() != 2 {
8584
return None;
8685
}

clippy_lints/src/misc.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use rustc_const_eval::EvalHint::ExprTypeChecked;
88
use rustc_const_eval::eval_const_expr_partial;
99
use rustc_const_math::ConstFloat;
1010
use syntax::codemap::{Span, Spanned, ExpnFormat};
11-
use syntax::ptr::P;
1211
use utils::{
1312
get_item_name, get_parent_expr, implements_trait, in_macro, is_integer_literal, match_path,
1413
snippet, span_lint, span_lint_and_then, walk_ptrs_ty
@@ -412,7 +411,7 @@ fn check_to_owned(cx: &LateContext, expr: &Expr, other: &Expr, left: bool, op: S
412411

413412
}
414413

415-
fn is_str_arg(cx: &LateContext, args: &[P<Expr>]) -> bool {
414+
fn is_str_arg(cx: &LateContext, args: &[Expr]) -> bool {
416415
args.len() == 1 &&
417416
matches!(walk_ptrs_ty(cx.tcx.tables().expr_ty(&args[0])).sty, ty::TyStr)
418417
}

clippy_lints/src/mut_reference.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use rustc::lint::*;
22
use rustc::ty::{TypeAndMut, TypeVariants, MethodCall, TyS};
33
use rustc::hir::*;
4-
use syntax::ptr::P;
54
use utils::span_lint;
65

76
/// **What it does:** Detects giving a mutable reference to a function that only
@@ -57,7 +56,7 @@ impl LateLintPass for UnnecessaryMutPassed {
5756
}
5857
}
5958

60-
fn check_arguments(cx: &LateContext, arguments: &[P<Expr>], type_definition: &TyS, name: &str) {
59+
fn check_arguments(cx: &LateContext, arguments: &[Expr], type_definition: &TyS, name: &str) {
6160
match type_definition.sty {
6261
TypeVariants::TyFnDef(_, _, fn_type) |
6362
TypeVariants::TyFnPtr(fn_type) => {

clippy_lints/src/no_effect.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ fn reduce_expression<'a>(cx: &LateContext, expr: &'a Expr) -> Option<Vec<&'a Exp
133133
Expr_::ExprIndex(ref a, ref b) |
134134
Expr_::ExprBinary(_, ref a, ref b) => Some(vec![&**a, &**b]),
135135
Expr_::ExprArray(ref v) |
136-
Expr_::ExprTup(ref v) => Some(v.iter().map(Deref::deref).collect()),
136+
Expr_::ExprTup(ref v) => Some(v.iter().collect()),
137137
Expr_::ExprRepeat(ref inner, _) |
138138
Expr_::ExprCast(ref inner, _) |
139139
Expr_::ExprType(ref inner, _) |
@@ -150,7 +150,7 @@ fn reduce_expression<'a>(cx: &LateContext, expr: &'a Expr) -> Option<Vec<&'a Exp
150150
Some(Def::Struct(..)) |
151151
Some(Def::Variant(..)) |
152152
Some(Def::StructCtor(..)) |
153-
Some(Def::VariantCtor(..)) => Some(args.iter().map(Deref::deref).collect()),
153+
Some(Def::VariantCtor(..)) => Some(args.iter().collect()),
154154
_ => None,
155155
}
156156
}

clippy_lints/src/transmute.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ impl LateLintPass for Transmute {
107107
e.span,
108108
"transmute from a reference to a pointer",
109109
|db| {
110-
if let Some(arg) = sugg::Sugg::hir_opt(cx, &*args[0]) {
110+
if let Some(arg) = sugg::Sugg::hir_opt(cx, &args[0]) {
111111
let sugg = if ptr_ty == rty {
112112
arg.as_ty(to_ty)
113113
} else {
@@ -125,7 +125,7 @@ impl LateLintPass for Transmute {
125125
e.span,
126126
"transmute from an integer to a pointer",
127127
|db| {
128-
if let Some(arg) = sugg::Sugg::hir_opt(cx, &*args[0]) {
128+
if let Some(arg) = sugg::Sugg::hir_opt(cx, &args[0]) {
129129
db.span_suggestion(e.span, "try", arg.as_ty(&to_ty.to_string()).to_string());
130130
}
131131
},

clippy_lints/src/utils/higher.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
use rustc::hir;
66
use rustc::lint::LateContext;
77
use syntax::ast;
8-
use syntax::ptr::P;
98
use utils::{is_expn_of, match_path, match_def_path, resolve_node, paths};
109

1110
/// Convert a hir binary operator to the corresponding `ast` type.
@@ -160,9 +159,9 @@ pub fn for_loop(expr: &hir::Expr) -> Option<(&hir::Pat, &hir::Expr, &hir::Expr)>
160159
/// Represent the pre-expansion arguments of a `vec!` invocation.
161160
pub enum VecArgs<'a> {
162161
/// `vec![elem; len]`
163-
Repeat(&'a P<hir::Expr>, &'a P<hir::Expr>),
162+
Repeat(&'a hir::Expr, &'a hir::Expr),
164163
/// `vec![a, b, c]`
165-
Vec(&'a [P<hir::Expr>]),
164+
Vec(&'a [hir::Expr]),
166165
}
167166

168167
/// Returns the arguments of the `vec!` macro if this expression was expanded from `vec!`.

0 commit comments

Comments
 (0)