Source::update takes mutable self

This commit is contained in:
Carl Lerche 2014-06-18 12:33:22 -07:00
parent bcf9028749
commit c665938dcc
5 changed files with 7 additions and 7 deletions

View File

@ -33,7 +33,7 @@ fn execute(options: Options) -> CLIResult<Option<()>> {
let source_id = SourceId::for_git(&url, reference.as_slice());
let source = GitSource::new(&source_id, &try!(Config::new().to_cli(1)));
let mut source = GitSource::new(&source_id, &try!(Config::new().to_cli(1)));
try!(source.update().map_err(|e| {
CLIError::new(format!("Couldn't update {}: {}", source, e), None::<&str>, 1)

View File

@ -72,7 +72,7 @@ impl PackageRegistry {
}
fn load(&mut self, namespace: &SourceId, override: bool) -> CargoResult<()> {
let source = namespace.load(&try!(Config::new()));
let mut source = namespace.load(&try!(Config::new()));
let dst = if override { &mut self.overrides } else { &mut self.summaries };
// Ensure the source has fetched all necessary remote data.

View File

@ -14,7 +14,7 @@ pub trait Source {
* get the entire list of all names, versions and dependencies of
* packages managed by the Source.
*/
fn update(&self) -> CargoResult<()>;
fn update(&mut self) -> CargoResult<()>;
/**
* The list method lists all names, versions and dependencies of
@ -111,8 +111,8 @@ impl SourceSet {
}
impl Source for SourceSet {
fn update(&self) -> CargoResult<()> {
for source in self.sources.iter() {
fn update(&mut self) -> CargoResult<()> {
for source in self.sources.mut_iter() {
try!(source.update());
}

View File

@ -91,7 +91,7 @@ impl Show for GitSource {
}
impl Source for GitSource {
fn update(&self) -> CargoResult<()> {
fn update(&mut self) -> CargoResult<()> {
println!("Updating git repository `{}`", self.remote.get_url());
log!(5, "updating git source `{}`", self.remote);
let repo = try!(self.remote.checkout(&self.db_path));

View File

@ -53,7 +53,7 @@ impl Show for PathSource {
}
impl Source for PathSource {
fn update(&self) -> CargoResult<()> {
fn update(&mut self) -> CargoResult<()> {
Ok(())
}