Skip to content

Update to rustc 1.9.0-nightly (e91f889ed 2016-03-03) #736

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

Merged
merged 3 commits into from
Mar 4, 2016
Merged
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
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "clippy"
version = "0.0.45"
version = "0.0.46"
authors = [
"Manish Goregaokar <[email protected]>",
"Andre Bogus <[email protected]>",
Expand Down
2 changes: 1 addition & 1 deletion src/cyclomatic_complexity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ impl<'a> Visitor<'a> for MatchArmCounter {
}
}

struct DivergenceCounter<'a, 'tcx: 'a>(u64, &'a ty::ctxt<'tcx>);
struct DivergenceCounter<'a, 'tcx: 'a>(u64, &'a ty::TyCtxt<'tcx>);

impl<'a, 'b, 'tcx> Visitor<'a> for DivergenceCounter<'b, 'tcx> {
fn visit_expr(&mut self, e: &'a Expr) {
Expand Down
14 changes: 5 additions & 9 deletions src/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use rustc::middle::ty::TypeVariants;
use rustc_front::hir::*;
use syntax::codemap::Span;
use syntax::ptr::P;
use utils::{BOX_NEW_PATH, VEC_FROM_ELEM_PATH};
use utils::VEC_FROM_ELEM_PATH;
use utils::{is_expn_of, match_path, snippet, span_lint_and_then};

/// **What it does:** This lint warns about using `&vec![..]` when using `&[..]` would be possible.
Expand Down Expand Up @@ -33,9 +33,7 @@ impl LintPass for UselessVec {

impl LateLintPass for UselessVec {
fn check_expr(&mut self, cx: &LateContext, expr: &Expr) {
unexpand_vec(cx, expr);

// search for `&!vec[_]` expressions where the adjusted type is `&[_]`
// search for `&vec![_]` expressions where the adjusted type is `&[_]`
if_let_chain!{[
let TypeVariants::TyRef(_, ref ty) = cx.tcx.expr_ty_adjusted(expr).sty,
let TypeVariants::TySlice(..) = ty.ty.sty,
Expand Down Expand Up @@ -71,7 +69,7 @@ impl LateLintPass for UselessVec {

/// Represent the pre-expansion arguments of a `vec!` invocation.
pub enum VecArgs<'a> {
/// `vec![elem, len]`
/// `vec![elem; len]`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That yak had a clean shave 😄

Repeat(&'a P<Expr>, &'a P<Expr>),
/// `vec![a, b, c]`
Vec(&'a [P<Expr>]),
Expand All @@ -91,10 +89,8 @@ pub fn unexpand_vec<'e>(cx: &LateContext, expr: &'e Expr) -> Option<VecArgs<'e>>
else if match_path(path, &["into_vec"]) && args.len() == 1 {
// `vec![a, b, c]` case
if_let_chain!{[
let ExprCall(ref fun, ref args) = args[0].node,
let ExprPath(_, ref path) = fun.node,
match_path(path, &BOX_NEW_PATH) && args.len() == 1,
let ExprVec(ref args) = args[0].node
let ExprBox(ref boxed) = args[0].node,
let ExprVec(ref args) = boxed.node
], {
return Some(VecArgs::Vec(&*args));
}}
Expand Down