fn find_minimum_rust_version(document: &Document) -> Option<&str> {
    /// Parses the `MSRV` as supported by Cargo since Rust 1.56.0
    ///
    /// [`Cargo`]: https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-version-field
    fn find_rust_version(document: &Document) -> Option<&str> {
        document
            .as_table()
            .get("package")
            .and_then(Item::as_table)
            .and_then(|package| package.get("rust-version"))
            .and_then(Item::as_str)
    }

    /// Parses the MSRV as supported by `cargo-msrv`, since prior to the release of Rust
    /// 1.56.0
    fn find_metadata_msrv(document: &Document) -> Option<&str> {
        document
            .as_table()
            .get("package")
            .and_then(Item::as_table)
            .and_then(|package| package.get("metadata"))
            .and_then(Item::as_table_like)
            .and_then(|metadata| metadata.get("msrv"))
            .and_then(Item::as_str)
    }

    // Parse the MSRV from the `package.rust-version` key if it exists,
    // and try to fallback to our own `package.metadata.msrv` if it doesn't
    find_rust_version(document).or_else(|| find_metadata_msrv(document))
}
/// Parse the minimum supported Rust version (MSRV) from `Cargo.toml` manifest data.
Parse the minimum supported Rust version (MSRV) from `Cargo.toml` manifest data.
Parse the minimum supported Rust version ( MSRV ) from ` Cargo . toml ` manifest data .
fn find_minimum_rust_version(document: &Document) -> Option<&str> {
    /// Parses the `MSRV` as supported by Cargo since Rust 1.56.0
    ///
    /// [`Cargo`]: https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-version-field
    fn find_rust_version(document: &Document) -> Option<&str> {
        document
            .as_table()
            .get("package")
            .and_then(Item::as_table)
            .and_then(|package| package.get("rust-version"))
            .and_then(Item::as_str)
    }
    /// Parses the MSRV as supported by `cargo-msrv`, since prior to the release of Rust
    /// 1.56.0
    fn find_metadata_msrv(document: &Document) -> Option<&str> {
        document
            .as_table()
            .get("package")
            .and_then(Item::as_table)
            .and_then(|package| package.get("metadata"))
            .and_then(Item::as_table_like)
            .and_then(|metadata| metadata.get("msrv"))
            .and_then(Item::as_str)
    }
    // Parse the MSRV from the `package.rust-version` key if it exists,
    // and try to fallback to our own `package.metadata.msrv` if it doesn't
    find_rust_version(document).or_else(|| find_metadata_msrv(document))
}
fn find_minimum_rust_version ( document : & Document ) -> Option < & str > { /// Parses the `MSRV` as supported by Cargo since Rust 1.56.0 /// /// [`Cargo`]: https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-version-field fn find_rust_version ( document : & Document ) -> Option < & str > { document . as_table ( ) . get ( " " ) . and_then ( Item :: as_table ) . and_then ( | package | package . get ( " " ) ) . and_then ( Item :: as_str ) } /// Parses the MSRV as supported by `cargo-msrv`, since prior to the release of Rust /// 1.56.0 fn find_metadata_msrv ( document : & Document ) -> Option < & str > { document . as_table ( ) . get ( " " ) . and_then ( Item :: as_table ) . and_then ( | package | package . get ( " " ) ) . and_then ( Item :: as_table_like ) . and_then ( | metadata | metadata . get ( " " ) ) . and_then ( Item :: as_str ) } // Parse the MSRV from the `package.rust-version` key if it exists, // and try to fallback to our own `package.metadata.msrv` if it doesn't find_rust_version ( document ) . or_else ( | | find_metadata_msrv ( document ) ) }
Parse the minimum supported Rust version (MSRV) from `Cargo.toml` manifest data.
Parse the minimum supported Rust version ( MSRV ) from ` Cargo . toml ` manifest data .
document
&Document
document
&Document