MCPcopy Create free account
hub / github.com/elastio/devx / rustfmt

Method rustfmt

devx-pre-commit/src/lib.rs:170–186  ·  view source on GitHub ↗

Runs `cargo fmt` against the [`Self::touched_crates()`]

(&self)

Source from the content-addressed store, hash-verified

168
169 /// Runs `cargo fmt` against the [`Self::touched_crates()`]
170 pub fn rustfmt(&self) -> Result<()> {
171 let touched_crates = self.touched_crates();
172 if touched_crates.is_empty() {
173 return Ok(());
174 }
175
176 cmd!(std::env::var("CARGO")
177 .as_ref()
178 .map(Deref::deref)
179 .unwrap_or("cargo"))
180 .arg("fmt")
181 .arg("--package")
182 .args(touched_crates)
183 .run()?;
184
185 Ok(())
186 }
187
188 /// Pushes the changes introduced to staged files in the working tree
189 /// to the git index. It is important to call this function once you've

Callers 1

run_hookFunction · 0.80

Calls 4

touched_cratesMethod · 0.80
runMethod · 0.80
argsMethod · 0.80
argMethod · 0.80

Tested by

no test coverage detected