1
Fork 0

Don't say you "should" use fully qualified syntax

That recommendation was removed last year; there isn't a particular
style that is officially recommended anymore.
This commit is contained in:
Camelid 2020-10-28 16:47:05 -07:00
parent e0eed3c558
commit 4e30e10f25
2 changed files with 16 additions and 10 deletions

View file

@ -44,15 +44,18 @@
//! Rc::downgrade(&my_rc);
//! ```
//!
//! `Rc<T>`'s implementations of traits like `Clone` should also be called using
//! fully qualified syntax to avoid confusion as to whether the *reference* is being
//! cloned or the *backing data* (`T`) is being cloned:
//! `Rc<T>`'s implementations of traits like `Clone` may also be called using
//! fully qualified syntax. Some people prefer to use fully qualified syntax,
//! while others prefer using method-call syntax.
//!
//! ```
//! use std::rc::Rc;
//!
//! let my_rc = Rc::new(());
//! let your_rc = Rc::clone(&my_rc);
//! let rc = Rc::new(());
//! // Method-call syntax
//! let rc2 = rc.clone();
//! // Fully qualified syntax
//! let rc3 = Rc::clone(&rc);
//! ```
//!
//! [`Weak<T>`][`Weak`] does not auto-dereference to `T`, because the inner value may have

View file

@ -138,15 +138,18 @@ macro_rules! acquire {
/// Arc::downgrade(&my_arc);
/// ```
///
/// `Arc<T>`'s implementations of traits like `Clone` should also be called using
/// fully qualified syntax to avoid confusion as to whether the *reference* is being
/// cloned or the *backing data* (`T`) is being cloned:
/// `Arc<T>`'s implementations of traits like `Clone` may also be called using
/// fully qualified syntax. Some people prefer to use fully qualified syntax,
/// while others prefer using method-call syntax.
///
/// ```
/// use std::sync::Arc;
///
/// let my_arc = Arc::new(());
/// let your_arc = Arc::clone(&my_arc);
/// let arc = Arc::new(());
/// // Method-call syntax
/// let arc2 = arc.clone();
/// // Fully qualified syntax
/// let arc3 = Arc::clone(&arc);
/// ```
///
/// [`Weak<T>`][Weak] does not auto-dereference to `T`, because the inner value may have