fn check_metadata(pkg: &Package, config: &Config) -> CargoResult<()> {
    let md = pkg.manifest().metadata();

    let mut missing = vec![];

    macro_rules! lacking {
        ($( $($field: ident)||* ),*) => {{
            $(
                if $(md.$field.as_ref().map_or(true, |s| s.is_empty()))&&* {
                    $(missing.push(stringify!($field).replace("_", "-"));)*
                }
            )*
        }}
    }
    lacking!(description, license || license_file, documentation || homepage || repository);

    if !missing.is_empty() {
        let mut things = missing[..missing.len() - 1].join(", ");
        // things will be empty if and only if length == 1 (i.e. the only case
        // to have no `or`).
        if !things.is_empty() {
            things.push_str(" or ");
        }
        things.push_str(&missing.last().unwrap());

        try!(config.shell().warn(
            &format!("manifest has no {things}. \
                    See http://doc.crates.io/manifest.html#package-metadata for more info.",
                    things = things)))
    }
    Ok(())
}
// check that the package has some piece of metadata that a human can
// use to tell what the package is about.
check that the package has some piece of metadata that a human can
use to tell what the package is about.
check that the package has some piece of metadata that a human can use to tell what the package is about .
fn check_metadata(pkg: &Package, config: &Config) -> CargoResult<()> {
    let md = pkg.manifest().metadata();
    let mut missing = vec![];
    macro_rules! lacking {
        ($( $($field: ident)||* ),*) => {{
            $(
                if $(md.$field.as_ref().map_or(true, |s| s.is_empty()))&&* {
                    $(missing.push(stringify!($field).replace("_", "-"));)*
                }
            )*
        }}
    }
    lacking!(description, license || license_file, documentation || homepage || repository);
    if !missing.is_empty() {
        let mut things = missing[..missing.len() - 1].join(", ");
        // things will be empty if and only if length == 1 (i.e. the only case
        // to have no `or`).
        if !things.is_empty() {
            things.push_str(" or ");
        }
        things.push_str(&missing.last().unwrap());
        try!(config.shell().warn(
            &format!("manifest has no {things}. \
                    See http://doc.crates.io/manifest.html#package-metadata for more info.",
                    things = things)))
    }
    Ok(())
}
fn check_metadata ( pkg : & Package , config : & Config ) -> CargoResult < ( ) > { let md = pkg . manifest ( ) . metadata ( ) ; let mut missing = vec ! [ ] ; macro_rules! lacking { ( $ ( $ ( $field : ident ) * ) * ) => { { $ ( if $ ( md $field as_ref ( ) map_or ( true s s is_empty ( ) ) ) * { $ ( missing push ( stringify ( $field ) replace ( " " " " ) ) ) * } ) * } } } lacking ! ( description license license_file documentation homepage repository ) ; if ! missing . is_empty ( ) { let mut things = missing [ .. missing . len ( ) - 1 ] . join ( " " ) ; // things will be empty if and only if length == 1 (i.e. the only case // to have no `or`). if ! things . is_empty ( ) { things . push_str ( " " ) ; } things . push_str ( & missing . last ( ) . unwrap ( ) ) ; try ! ( config shell ( ) warn ( format ( " \
 " things things ) ) ) } Ok ( ( ) ) }
check that the package has some piece of metadata that a human can
use to tell what the package is about.
check that the package has some piece of metadata that a human can use to tell what the package is about .
pkg
&Package
config
&Config
pkg
&Package
config
&Config