Source::update takes mutable self
authorCarl Lerche <me@carllerche.com>
Wed, 18 Jun 2014 19:33:22 +0000 (12:33 -0700)
committerCarl Lerche <me@carllerche.com>
Wed, 18 Jun 2014 19:33:22 +0000 (12:33 -0700)
src/bin/cargo-git-checkout.rs
src/cargo/core/registry.rs
src/cargo/core/source.rs
src/cargo/sources/git/source.rs
src/cargo/sources/path.rs

index 2fcac0cad626f58124dabb741263cd4a64c916ad..64ddc176da4a9cb069e00515f7409cc070cb823f 100644 (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)
index 508c121bf4149228ac2af977318bed5979d2ab1e..9aadb3fdb18bace8be972528fbda24f08ff92b1e 100644 (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.
index bd9e67898c217f9570f5cc1852023b51c2283793..7fa205bdd4deb9351c2e15dcbd3ee9ac715b6f9d 100644 (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());
         }
 
index 21affc5e24f8a2196fc76a1eb97c436417cccee0..cc59f253a232f7df601283005feb784ad51187b4 100644 (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));
index 36b40588776a252f9d0aa3fbf269c518e4682b5a..1322ce1e12f4b982cd2f4bc2b834accf5bb815de 100644 (file)
@@ -53,7 +53,7 @@ impl Show for PathSource {
 }
 
 impl Source for PathSource {
-    fn update(&self) -> CargoResult<()> {
+    fn update(&mut self) -> CargoResult<()> {
         Ok(())
     }