MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / rustfmt

Function rustfmt

crates/cli/src/tasks/rust.rs:172–191  ·  view source on GitHub ↗
(files: impl IntoIterator<Item = PathBuf>)

Source from the content-addressed store, hash-verified

170}
171
172pub(crate) fn rustfmt(files: impl IntoIterator<Item = PathBuf>) -> anyhow::Result<()> {
173 if !has_rust_fmt() {
174 if has_rust_up() {
175 cmd!("rustup", "component", "add", "rustfmt")
176 .run()
177 .context("Failed to install rustfmt with Rustup")?;
178 } else {
179 anyhow::bail!("rustfmt is not installed. Please install it.");
180 }
181 }
182 cmd(
183 "rustfmt",
184 itertools::chain(
185 ["--edition", "2021"].into_iter().map_into::<OsString>(),
186 files.into_iter().map_into(),
187 ),
188 )
189 .run()?;
190 Ok(())
191}

Callers 1

format_filesMethod · 0.85

Calls 5

has_rust_fmtFunction · 0.85
has_rust_upFunction · 0.85
OkFunction · 0.50
runMethod · 0.45
into_iterMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…