fn fmt()

in src/bindgen/error.rs [31:75]


    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        match *self {
            Error::CargoMetadata(ref path, ref error) => write!(
                f,
                "Couldn't execute `cargo metadata` with manifest {:?}: {:?}",
                path, error
            ),
            Error::CargoToml(ref path, ref error) => {
                write!(f, "Couldn't load manifest file {:?}: {:?}", path, error)
            }
            Error::CargoExpand(ref crate_name, ref error) => write!(
                f,
                "Parsing crate `{}`: couldn't run `cargo rustc -Zunpretty=expanded`: {:?}",
                crate_name, error
            ),
            Error::ParseSyntaxError {
                ref crate_name,
                ref src_path,
                ref error,
            } => {
                write!(
                    f,
                    "Parsing crate `{}`:`{}`:\n{:?}",
                    crate_name, src_path, error
                )?;

                if !src_path.is_empty() {
                    write!(
                        f,
                        "\nTry running `rustc -Z parse-crate-root-only {}` to see a nicer error message",
                        src_path,
                    )?
                }
                Ok(())
            }
            Error::ParseCannotOpenFile {
                ref crate_name,
                ref src_path,
            } => write!(
                f,
                "Parsing crate `{}`: cannot open file `{}`.",
                crate_name, src_path
            ),
        }
    }