diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index 9e2fa03f88..2854631c6f 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs @@ -227,11 +227,9 @@ impl Module { Some((name, def)) } }) - .flat_map(|(name, def)| - ScopeDef::all_items(def) - .into_iter() - .map(move |item| (name.clone(), item)) - ) + .flat_map(|(name, def)| { + ScopeDef::all_items(def).into_iter().map(move |item| (name.clone(), item)) + }) .collect() } @@ -1298,10 +1296,8 @@ impl ScopeDef { let mut items = ArrayVec::new(); match (def.take_types(), def.take_values()) { - (Some(m1), None) => - items.push(ScopeDef::ModuleDef(m1.into())), - (None, Some(m2)) => - items.push(ScopeDef::ModuleDef(m2.into())), + (Some(m1), None) => items.push(ScopeDef::ModuleDef(m1.into())), + (None, Some(m2)) => items.push(ScopeDef::ModuleDef(m2.into())), (Some(m1), Some(m2)) => { // Some items, like unit structs and enum variants, are // returned as both a type and a value. Here we want @@ -1312,8 +1308,8 @@ impl ScopeDef { } else { items.push(ScopeDef::ModuleDef(m1.into())); } - }, - (None, None) => {}, + } + (None, None) => {} }; if let Some(macro_def_id) = def.take_macros() { diff --git a/crates/ra_hir/src/semantics.rs b/crates/ra_hir/src/semantics.rs index e83eb1fdc2..788bb3eb7a 100644 --- a/crates/ra_hir/src/semantics.rs +++ b/crates/ra_hir/src/semantics.rs @@ -349,8 +349,8 @@ impl<'a, DB: HirDatabase> SemanticsScope<'a, DB> { for item in items { f(name.clone(), item); } - return - }, + return; + } resolver::ScopeDef::ImplSelfType(it) => ScopeDef::ImplSelfType(it.into()), resolver::ScopeDef::AdtSelfType(it) => ScopeDef::AdtSelfType(it.into()), resolver::ScopeDef::GenericParam(id) => ScopeDef::GenericParam(TypeParam { id }), diff --git a/crates/ra_ide/src/completion/complete_path.rs b/crates/ra_ide/src/completion/complete_path.rs index 648c1d39b2..65b3bf6e64 100644 --- a/crates/ra_ide/src/completion/complete_path.rs +++ b/crates/ra_ide/src/completion/complete_path.rs @@ -1005,5 +1005,4 @@ mod tests { "### ); } - } diff --git a/xtask/src/lib.rs b/xtask/src/lib.rs index 014b61b371..e1472e85d8 100644 --- a/xtask/src/lib.rs +++ b/xtask/src/lib.rs @@ -38,13 +38,11 @@ pub fn project_root() -> PathBuf { } pub fn run_rustfmt(mode: Mode) -> Result<()> { + let _dir = pushd(project_root()); ensure_rustfmt()?; - if mode == Mode::Verify { - run!("rustup run {} -- cargo fmt -- --check", TOOLCHAIN)?; - } else { - run!("rustup run {} -- cargo fmt", TOOLCHAIN)?; - } + let check = if mode == Mode::Verify { "--check" } else { "" }; + run!("rustup run {} -- cargo fmt -- {}", TOOLCHAIN, check)?; Ok(()) }