File tree 2 files changed +16
-10
lines changed
2 files changed +16
-10
lines changed Original file line number Diff line number Diff line change 44
44
//! Rc::downgrade(&my_rc);
45
45
//! ```
46
46
//!
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.
50
50
//!
51
51
//! ```
52
52
//! use std::rc::Rc;
53
53
//!
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);
56
59
//! ```
57
60
//!
58
61
//! [`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 {
138
138
/// Arc::downgrade(&my_arc);
139
139
/// ```
140
140
///
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.
144
144
///
145
145
/// ```
146
146
/// use std::sync::Arc;
147
147
///
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);
150
153
/// ```
151
154
///
152
155
/// [`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