fn add_overrides<'a>(registry: &mut PackageRegistry<'a>,
                     cur_path: &Path,
                     config: &'a Config) -> CargoResult<()> {
    let paths = match try!(config.get_list("paths")) {
        Some(list) => list,
        None => return Ok(())
    };
    let paths = paths.val.iter().map(|&(ref s, ref p)| {
        // The path listed next to the string is the config file in which the
        // key was located, so we want to pop off the `.cargo/config` component
        // to get the directory containing the `.cargo` folder.
        (p.parent().unwrap().parent().unwrap().join(s), p)
    }).filter(|&(ref p, _)| {
        // Make sure we don't override the local package, even if it's in the
        // list of override paths.
        cur_path != &**p
    });

    for (path, definition) in paths {
        let id = try!(SourceId::for_path(&path));
        let mut source = PathSource::new_recursive(&path, &id, config);
        try!(source.update().chain_error(|| {
            human(format!("failed to update path override `{}` \
                           (defined in `{}`)", path.display(),
                          definition.display()))
        }));
        registry.add_override(&id, Box::new(source));
    }
    Ok(())
}
/// Read the `paths` configuration variable to discover all path overrides that
/// have been configured.
Read the `paths` configuration variable to discover all path overrides that
have been configured.
Read the ` paths ` configuration variable to discover all path overrides that have been configured .
fn add_overrides<'a>(registry: &mut PackageRegistry<'a>,
                     cur_path: &Path,
                     config: &'a Config) -> CargoResult<()> {
    let paths = match try!(config.get_list("paths")) {
        Some(list) => list,
        None => return Ok(())
    };
    let paths = paths.val.iter().map(|&(ref s, ref p)| {
        // The path listed next to the string is the config file in which the
        // key was located, so we want to pop off the `.cargo/config` component
        // to get the directory containing the `.cargo` folder.
        (p.parent().unwrap().parent().unwrap().join(s), p)
    }).filter(|&(ref p, _)| {
        // Make sure we don't override the local package, even if it's in the
        // list of override paths.
        cur_path != &**p
    });
    for (path, definition) in paths {
        let id = try!(SourceId::for_path(&path));
        let mut source = PathSource::new_recursive(&path, &id, config);
        try!(source.update().chain_error(|| {
            human(format!("failed to update path override `{}` \
                           (defined in `{}`)", path.display(),
                          definition.display()))
        }));
        registry.add_override(&id, Box::new(source));
    }
    Ok(())
}
fn add_overrides < ' a > ( registry : & mut PackageRegistry < ' a > , cur_path : & Path , config : & ' a Config ) -> CargoResult < ( ) > { let paths = match try ! ( config get_list ( " " ) ) { Some ( list ) => list , None => return Ok ( ( ) ) } ; let paths = paths . val . iter ( ) . map ( | & ( ref s , ref p ) | { // The path listed next to the string is the config file in which the // key was located, so we want to pop off the `.cargo/config` component // to get the directory containing the `.cargo` folder. ( p . parent ( ) . unwrap ( ) . parent ( ) . unwrap ( ) . join ( s ) , p ) } ) . filter ( | & ( ref p , _ ) | { // Make sure we don't override the local package, even if it's in the // list of override paths. cur_path != & * * p } ) ; for ( path , definition ) in paths { let id = try ! ( SourceId for_path ( path ) ) ; let mut source = PathSource :: new_recursive ( & path , & id , config ) ; try ! ( source update ( ) chain_error ( { human ( format ( " \
 " path display ( ) definition display ( ) ) ) } ) ) ; registry . add_override ( & id , Box :: new ( source ) ) ; } Ok ( ( ) ) }
Read the `paths` configuration variable to discover all path overrides that
have been configured.
Read the ` paths ` configuration variable to discover all path overrides that have been configured .
registry
&mut PackageRegistry<'a>
cur_path
&Path
config
&'a Config
registry
&mut PackageRegistry<'a>
cur_path
&Path
config
&'a Config