Skip to content

Commit 680182d

Browse files
committed
Restore cargo-fmt gating
1 parent 1e19847 commit 680182d

File tree

4 files changed

+12
-19
lines changed

4 files changed

+12
-19
lines changed

crates/ra_hir/src/code_model.rs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -227,11 +227,9 @@ impl Module {
227227
Some((name, def))
228228
}
229229
})
230-
.flat_map(|(name, def)|
231-
ScopeDef::all_items(def)
232-
.into_iter()
233-
.map(move |item| (name.clone(), item))
234-
)
230+
.flat_map(|(name, def)| {
231+
ScopeDef::all_items(def).into_iter().map(move |item| (name.clone(), item))
232+
})
235233
.collect()
236234
}
237235

@@ -1298,10 +1296,8 @@ impl ScopeDef {
12981296
let mut items = ArrayVec::new();
12991297

13001298
match (def.take_types(), def.take_values()) {
1301-
(Some(m1), None) =>
1302-
items.push(ScopeDef::ModuleDef(m1.into())),
1303-
(None, Some(m2)) =>
1304-
items.push(ScopeDef::ModuleDef(m2.into())),
1299+
(Some(m1), None) => items.push(ScopeDef::ModuleDef(m1.into())),
1300+
(None, Some(m2)) => items.push(ScopeDef::ModuleDef(m2.into())),
13051301
(Some(m1), Some(m2)) => {
13061302
// Some items, like unit structs and enum variants, are
13071303
// returned as both a type and a value. Here we want
@@ -1312,8 +1308,8 @@ impl ScopeDef {
13121308
} else {
13131309
items.push(ScopeDef::ModuleDef(m1.into()));
13141310
}
1315-
},
1316-
(None, None) => {},
1311+
}
1312+
(None, None) => {}
13171313
};
13181314

13191315
if let Some(macro_def_id) = def.take_macros() {

crates/ra_hir/src/semantics.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,8 @@ impl<'a, DB: HirDatabase> SemanticsScope<'a, DB> {
349349
for item in items {
350350
f(name.clone(), item);
351351
}
352-
return
353-
},
352+
return;
353+
}
354354
resolver::ScopeDef::ImplSelfType(it) => ScopeDef::ImplSelfType(it.into()),
355355
resolver::ScopeDef::AdtSelfType(it) => ScopeDef::AdtSelfType(it.into()),
356356
resolver::ScopeDef::GenericParam(id) => ScopeDef::GenericParam(TypeParam { id }),

crates/ra_ide/src/completion/complete_path.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1005,5 +1005,4 @@ mod tests {
10051005
"###
10061006
);
10071007
}
1008-
10091008
}

xtask/src/lib.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,11 @@ pub fn project_root() -> PathBuf {
3838
}
3939

4040
pub fn run_rustfmt(mode: Mode) -> Result<()> {
41+
let _dir = pushd(project_root());
4142
ensure_rustfmt()?;
4243

43-
if mode == Mode::Verify {
44-
run!("rustup run {} -- cargo fmt -- --check", TOOLCHAIN)?;
45-
} else {
46-
run!("rustup run {} -- cargo fmt", TOOLCHAIN)?;
47-
}
44+
let check = if mode == Mode::Verify { "--check" } else { "" };
45+
run!("rustup run {} -- cargo fmt -- {}", TOOLCHAIN, check)?;
4846
Ok(())
4947
}
5048

0 commit comments

Comments
 (0)