Document overrides of clone_from()
Specifically, when an override doesn't just forward to an inner type, document the behavior and that it's preferred over simply assigning a clone of source. Also, change instances where the second parameter is "other" to "source".
This commit is contained in:
parent
bfe762e0ed
commit
c0e913fdd7
14 changed files with 134 additions and 24 deletions
|
@ -1628,6 +1628,10 @@ impl Clone for PathBuf {
|
|||
PathBuf { inner: self.inner.clone() }
|
||||
}
|
||||
|
||||
/// Clones the contents of `source` into `self`.
|
||||
///
|
||||
/// This method is preferred over simply assigning `source.clone()` to `self`,
|
||||
/// as it avoids reallocation if possible.
|
||||
#[inline]
|
||||
fn clone_from(&mut self, source: &Self) {
|
||||
self.inner.clone_from(&source.inner)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue