From c665938dcc692ac1db7ea8ffd095e5fbb2bbfba8 Mon Sep 17 00:00:00 2001 From: Carl Lerche Date: Wed, 18 Jun 2014 12:33:22 -0700 Subject: [PATCH] Source::update takes mutable self --- src/bin/cargo-git-checkout.rs | 2 +- src/cargo/core/registry.rs | 2 +- src/cargo/core/source.rs | 6 +++--- src/cargo/sources/git/source.rs | 2 +- src/cargo/sources/path.rs | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/bin/cargo-git-checkout.rs b/src/bin/cargo-git-checkout.rs index 2fcac0cad..64ddc176d 100644 --- a/src/bin/cargo-git-checkout.rs +++ b/src/bin/cargo-git-checkout.rs @@ -33,7 +33,7 @@ fn execute(options: Options) -> CLIResult> { 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) diff --git a/src/cargo/core/registry.rs b/src/cargo/core/registry.rs index 508c121bf..9aadb3fdb 100644 --- a/src/cargo/core/registry.rs +++ b/src/cargo/core/registry.rs @@ -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. diff --git a/src/cargo/core/source.rs b/src/cargo/core/source.rs index bd9e67898..7fa205bdd 100644 --- a/src/cargo/core/source.rs +++ b/src/cargo/core/source.rs @@ -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()); } diff --git a/src/cargo/sources/git/source.rs b/src/cargo/sources/git/source.rs index 21affc5e2..cc59f253a 100644 --- a/src/cargo/sources/git/source.rs +++ b/src/cargo/sources/git/source.rs @@ -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)); diff --git a/src/cargo/sources/path.rs b/src/cargo/sources/path.rs index 36b405887..1322ce1e1 100644 --- a/src/cargo/sources/path.rs +++ b/src/cargo/sources/path.rs @@ -53,7 +53,7 @@ impl Show for PathSource { } impl Source for PathSource { - fn update(&self) -> CargoResult<()> { + fn update(&mut self) -> CargoResult<()> { Ok(()) }