(files: impl IntoIterator<Item = PathBuf>)
| 170 | } |
| 171 | |
| 172 | pub(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 | } |
no test coverage detected
searching dependent graphs…