Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rustup #4218

Merged
merged 2 commits into from
Jun 19, 2019
Merged

Rustup #4218

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions clippy_lints/src/loops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ fn never_loop_expr(expr: &Expr, main_loop_id: HirId) -> NeverLoopResult {
}
},
ExprKind::Struct(_, _, None)
| ExprKind::Yield(_)
| ExprKind::Yield(_, _)
| ExprKind::Closure(_, _, _, _, _)
| ExprKind::InlineAsm(_, _, _)
| ExprKind::Path(_)
Expand Down Expand Up @@ -1245,7 +1245,12 @@ fn is_len_call(expr: &Expr, var: Name) -> bool {
false
}

fn is_end_eq_array_len(cx: &LateContext<'_, '_>, end: &Expr, limits: ast::RangeLimits, indexed_ty: Ty<'_>) -> bool {
fn is_end_eq_array_len<'tcx>(
cx: &LateContext<'_, 'tcx>,
end: &Expr,
limits: ast::RangeLimits,
indexed_ty: Ty<'tcx>,
) -> bool {
if_chain! {
if let ExprKind::Lit(ref lit) = end.node;
if let ast::LitKind::Int(end_int, _) = lit.node;
Expand Down Expand Up @@ -1982,7 +1987,7 @@ fn is_ref_iterable_type(cx: &LateContext<'_, '_>, e: &Expr) -> bool {
match_type(cx, ty, &paths::BTREESET)
}

fn is_iterable_array(ty: Ty<'_>, cx: &LateContext<'_, '_>) -> bool {
fn is_iterable_array<'tcx>(ty: Ty<'tcx>, cx: &LateContext<'_, 'tcx>) -> bool {
// IntoIterator is currently only implemented for array sizes <= 32 in rustc
match ty.sty {
ty::Array(_, n) => (0..=32).contains(&n.assert_usize(cx.tcx).expect("array length")),
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/methods/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1773,7 +1773,7 @@ fn derefs_to_slice<'a, 'tcx>(
expr: &'tcx hir::Expr,
ty: Ty<'tcx>,
) -> Option<&'tcx hir::Expr> {
fn may_slice(cx: &LateContext<'_, '_>, ty: Ty<'_>) -> bool {
fn may_slice<'a>(cx: &LateContext<'_, 'a>, ty: Ty<'a>) -> bool {
phansch marked this conversation as resolved.
Show resolved Hide resolved
match ty.sty {
ty::Slice(_) => true,
ty::Adt(def, _) if def.is_box() => may_slice(cx, ty.boxed_ty()),
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/utils/author.rs
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ impl<'tcx> Visitor<'tcx> for PrintVisitor {
println!("Closure(ref capture_clause, ref func, _, _, _) = {};", current);
println!(" // unimplemented: `ExprKind::Closure` is not further destructured at the moment");
},
ExprKind::Yield(ref sub) => {
ExprKind::Yield(ref sub, _) => {
let sub_pat = self.next("sub");
println!("Yield(ref sub) = {};", current);
self.current = sub_pat;
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/utils/hir_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ impl<'a, 'tcx: 'a> SpanlessHash<'a, 'tcx> {
self.hash_expr(&*j);
}
},
ExprKind::Box(ref e) | ExprKind::DropTemps(ref e) | ExprKind::Yield(ref e) => {
ExprKind::Box(ref e) | ExprKind::DropTemps(ref e) | ExprKind::Yield(ref e, _) => {
self.hash_expr(e);
},
ExprKind::Call(ref fun, ref args) => {
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/utils/inspector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ fn print_expr(cx: &LateContext<'_, '_>, expr: &hir::Expr, indent: usize) {
println!("{}Closure", ind);
println!("{}clause: {:?}", ind, clause);
},
hir::ExprKind::Yield(ref sub) => {
hir::ExprKind::Yield(ref sub, _) => {
println!("{}Yield", ind);
print_expr(cx, sub, indent + 1);
},
Expand Down