Merge branch 'master' into unnecessary_filter_map

This commit is contained in:
Michael Wright
2018-09-27 06:12:01 +02:00
3 changed files with 8 additions and 5 deletions

View File

@@ -33,6 +33,7 @@ unicode-normalization = "0.1"
pulldown-cmark = "0.1" pulldown-cmark = "0.1"
url = "1.7.0" url = "1.7.0"
if_chain = "0.1.3" if_chain = "0.1.3"
smallvec = { version = "0.6.5", features = ["union"] }
[features] [features]
debugging = [] debugging = []

View File

@@ -6,7 +6,7 @@ use crate::rustc_data_structures::fx::FxHashMap;
use std::collections::hash_map::Entry; use std::collections::hash_map::Entry;
use std::hash::BuildHasherDefault; use std::hash::BuildHasherDefault;
use crate::syntax::symbol::LocalInternedString; use crate::syntax::symbol::LocalInternedString;
use crate::rustc_data_structures::small_vec::OneVector; use smallvec::SmallVec;
use crate::utils::{SpanlessEq, SpanlessHash}; use crate::utils::{SpanlessEq, SpanlessHash};
use crate::utils::{get_parent_expr, in_macro, snippet, span_lint_and_then, span_note_and_lint}; use crate::utils::{get_parent_expr, in_macro, snippet, span_lint_and_then, span_note_and_lint};
@@ -235,9 +235,9 @@ fn lint_match_arms(cx: &LateContext<'_, '_>, expr: &Expr) {
/// sequence of `if/else`. /// sequence of `if/else`.
/// Eg. would return `([a, b], [c, d, e])` for the expression /// Eg. would return `([a, b], [c, d, e])` for the expression
/// `if a { c } else if b { d } else { e }`. /// `if a { c } else if b { d } else { e }`.
fn if_sequence(mut expr: &Expr) -> (OneVector<&Expr>, OneVector<&Block>) { fn if_sequence(mut expr: &Expr) -> (SmallVec<[&Expr; 1]>, SmallVec<[&Block; 1]>) {
let mut conds = OneVector::new(); let mut conds = SmallVec::new();
let mut blocks: OneVector<&Block> = OneVector::new(); let mut blocks: SmallVec<[&Block; 1]> = SmallVec::new();
while let ExprKind::If(ref cond, ref then_expr, ref else_expr) = expr.node { while let ExprKind::If(ref cond, ref then_expr, ref else_expr) = expr.node {
conds.push(&**cond); conds.push(&**cond);

View File

@@ -4,14 +4,16 @@ fn dogfood() {
return; return;
} }
let root_dir = std::env::current_dir().unwrap(); let root_dir = std::env::current_dir().unwrap();
for d in &[".", "clippy_lints"] { for d in &[".", "clippy_lints", "rustc_tools_util", "clippy_dev"] {
std::env::set_current_dir(root_dir.join(d)).unwrap(); std::env::set_current_dir(root_dir.join(d)).unwrap();
let output = std::process::Command::new("cargo") let output = std::process::Command::new("cargo")
.arg("run") .arg("run")
.arg("--bin") .arg("--bin")
.arg("cargo-clippy") .arg("cargo-clippy")
.arg("--all-features")
.arg("--manifest-path") .arg("--manifest-path")
.arg(root_dir.join("Cargo.toml")) .arg(root_dir.join("Cargo.toml"))
.args(&["--", "-W clippy::internal"])
.env("CLIPPY_DOGFOOD", "true") .env("CLIPPY_DOGFOOD", "true")
.output() .output()
.unwrap(); .unwrap();