ferrous-forge 1.9.6

System-wide Rust development standards enforcer
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Formatting utility functions

use crate::{Error, Result};

/// Ensure rustfmt is installed and available
pub(super) async fn ensure_rustfmt_installed() -> Result<()> {
    let output = tokio::process::Command::new("rustfmt")
        .arg("--version")
        .output()
        .await
        .map_err(|_| Error::tool_not_found("rustfmt"))?;

    if !output.status.success() {
        return Err(Error::tool_not_found("rustfmt"));
    }

    Ok(())
}