INNER CODE UNIT · Rust

format_code

obmarg/cynic · cynic-codegen/src/lib.rs:50

fn format_code(filename: &std::path::Path) -> std::io::Result<()> {
    #[cfg(feature = "rustfmt")]
    {
        std::process::Command::new("cargo")
            .args(["fmt", "--", filename.to_str().unwrap()])
            .spawn()?;
    }
    Ok(())
}

fn variables_fields_path(variables: Option<&syn::Path>) -> Option<syn::Path> {
    variables.cloned().map(|mut variables| {
        // Find VariablesField struct name from Variables struct name
        if let Some(last) = variables.segments.last_mut() {
            last.ident = variables_fields_ident(&last.ident);
        }
        variables
    })

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…