Skip to content

Commit 7dd618f

Browse files
committed
Address review comments
1 parent 9697076 commit 7dd618f

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/liballoc/arc.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -924,19 +924,18 @@ impl<T> Weak<T> {
924924
///
925925
/// use std::sync::Arc;
926926
///
927-
/// let five = Arc::new(5);
927+
/// let empty: Weak<i64> = Weak::new();
928928
/// ```
929929
#[unstable(feature = "downgraded_weak",
930930
reason = "recently added",
931931
issue = "30425")]
932932
pub fn new() -> Weak<T> {
933933
unsafe {
934-
let x: Box<_> = box ArcInner {
934+
Weak { _ptr: Shared::new(Box::into_raw(box ArcInner {
935935
strong: atomic::AtomicUsize::new(0),
936936
weak: atomic::AtomicUsize::new(1),
937937
data: uninitialized(),
938-
};
939-
Weak { _ptr: Shared::new(Box::into_raw(x)) }
938+
}))}
940939
}
941940
}
942941
}

src/liballoc/rc.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -843,9 +843,8 @@ impl<T> Weak<T> {
843843
///
844844
/// use std::rc::Weak;
845845
///
846-
/// let empty:Weak<i64> = Weak::new();
846+
/// let empty: Weak<i64> = Weak::new();
847847
/// ```
848-
849848
#[unstable(feature = "downgraded_weak",
850849
reason = "recently added",
851850
issue="30425")]

0 commit comments

Comments
 (0)