File tree Expand file tree Collapse file tree 2 files changed +16
-10
lines changed Expand file tree Collapse file tree 2 files changed +16
-10
lines changed Original file line number Diff line number Diff line change 4444//! Rc::downgrade(&my_rc);
4545//! ```
4646//!
47- //! `Rc<T>`'s implementations of traits like `Clone` should also be called using
48- //! fully qualified syntax to avoid confusion as to whether the *reference* is being
49- //! cloned or the *backing data* (`T`) is being cloned:
47+ //! `Rc<T>`'s implementations of traits like `Clone` may also be called using
48+ //! fully qualified syntax. Some people prefer to use fully qualified syntax,
49+ //! while others prefer using method-call syntax.
5050//!
5151//! ```
5252//! use std::rc::Rc;
5353//!
54- //! let my_rc = Rc::new(());
55- //! let your_rc = Rc::clone(&my_rc);
54+ //! let rc = Rc::new(());
55+ //! // Method-call syntax
56+ //! let rc2 = rc.clone();
57+ //! // Fully qualified syntax
58+ //! let rc3 = Rc::clone(&rc);
5659//! ```
5760//!
5861//! [`Weak<T>`][`Weak`] does not auto-dereference to `T`, because the inner value may have
Original file line number Diff line number Diff line change @@ -138,15 +138,18 @@ macro_rules! acquire {
138138/// Arc::downgrade(&my_arc);
139139/// ```
140140///
141- /// `Arc<T>`'s implementations of traits like `Clone` should also be called using
142- /// fully qualified syntax to avoid confusion as to whether the *reference* is being
143- /// cloned or the *backing data* (`T`) is being cloned:
141+ /// `Arc<T>`'s implementations of traits like `Clone` may also be called using
142+ /// fully qualified syntax. Some people prefer to use fully qualified syntax,
143+ /// while others prefer using method-call syntax.
144144///
145145/// ```
146146/// use std::sync::Arc;
147147///
148- /// let my_arc = Arc::new(());
149- /// let your_arc = Arc::clone(&my_arc);
148+ /// let arc = Arc::new(());
149+ /// // Method-call syntax
150+ /// let arc2 = arc.clone();
151+ /// // Fully qualified syntax
152+ /// let arc3 = Arc::clone(&arc);
150153/// ```
151154///
152155/// [`Weak<T>`][Weak] does not auto-dereference to `T`, because the inner value may have
You can’t perform that action at this time.
0 commit comments