From 83131fca59b1c9e6fa779177912a7d9bc4e89c9f Mon Sep 17 00:00:00 2001 From: Weihang Lo Date: Thu, 18 May 2023 14:25:42 +0100 Subject: [PATCH] docs(source): consolidate "forwards methods" comment in one place --- src/cargo/core/source/mod.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/cargo/core/source/mod.rs b/src/cargo/core/source/mod.rs index 712111f71ca..bdf5d4cda4a 100644 --- a/src/cargo/core/source/mod.rs +++ b/src/cargo/core/source/mod.rs @@ -184,28 +184,24 @@ pub enum MaybePackage { }, } +/// A blanket implementation forwards all methods to [`Source`]. impl<'a, T: Source + ?Sized + 'a> Source for Box { - /// Forwards to `Source::source_id`. fn source_id(&self) -> SourceId { (**self).source_id() } - /// Forwards to `Source::replaced_source_id`. fn replaced_source_id(&self) -> SourceId { (**self).replaced_source_id() } - /// Forwards to `Source::supports_checksums`. fn supports_checksums(&self) -> bool { (**self).supports_checksums() } - /// Forwards to `Source::requires_precise`. fn requires_precise(&self) -> bool { (**self).requires_precise() } - /// Forwards to `Source::query`. fn query( &mut self, dep: &Dependency, @@ -223,7 +219,6 @@ impl<'a, T: Source + ?Sized + 'a> Source for Box { (**self).set_quiet(quiet) } - /// Forwards to `Source::download`. fn download(&mut self, id: PackageId) -> CargoResult { (**self).download(id) } @@ -232,12 +227,10 @@ impl<'a, T: Source + ?Sized + 'a> Source for Box { (**self).finish_download(id, data) } - /// Forwards to `Source::fingerprint`. fn fingerprint(&self, pkg: &Package) -> CargoResult { (**self).fingerprint(pkg) } - /// Forwards to `Source::verify`. fn verify(&self, pkg: PackageId) -> CargoResult<()> { (**self).verify(pkg) } @@ -263,6 +256,7 @@ impl<'a, T: Source + ?Sized + 'a> Source for Box { } } +/// A blanket implementation forwards all methods to [`Source`]. impl<'a, T: Source + ?Sized + 'a> Source for &'a mut T { fn source_id(&self) -> SourceId { (**self).source_id()