Skip to content

Commit 4e30e10

Browse files
committed
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.
1 parent e0eed3c commit 4e30e10

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

library/alloc/src/rc.rs

+8-5
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,18 @@
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

library/alloc/src/sync.rs

+8-5
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)