diff options
| author | bors <bors@rust-lang.org> | 2024-12-18 19:16:15 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-12-18 19:16:15 +0000 |
| commit | 4ba4ac612d36e3409e8e1e31e12acc028808f85f (patch) | |
| tree | 4984f3ca5507abb2a5ccd2aad7346390edff999f /library/alloc/src | |
| parent | a52085d9f6a6e596b0cbad4502cddf86bc878028 (diff) | |
| parent | a105cd606628b07e79ab343cc183a176e278c809 (diff) | |
| download | rust-4ba4ac612d36e3409e8e1e31e12acc028808f85f.tar.gz rust-4ba4ac612d36e3409e8e1e31e12acc028808f85f.zip | |
Auto merge of #134443 - joshtriplett:use-field-init-shorthand, r=lqd,tgross35,nnethercote
Use field init shorthand where possible Field init shorthand allows writing initializers like `tcx: tcx` as `tcx`. The compiler already uses it extensively. Fix the last few places where it isn't yet used. EDIT: this PR also updates `rustfmt.toml` to set `use_field_init_shorthand = true`.
Diffstat (limited to 'library/alloc/src')
| -rw-r--r-- | library/alloc/src/rc.rs | 2 | ||||
| -rw-r--r-- | library/alloc/src/sync.rs | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/library/alloc/src/rc.rs b/library/alloc/src/rc.rs index bb27fe3c62d..b7ec3af9818 100644 --- a/library/alloc/src/rc.rs +++ b/library/alloc/src/rc.rs @@ -795,7 +795,7 @@ impl<T, A: Allocator> Rc<T, A> { let uninit_ptr: NonNull<_> = (unsafe { &mut *uninit_raw_ptr }).into(); let init_ptr: NonNull<RcInner<T>> = uninit_ptr.cast(); - let weak = Weak { ptr: init_ptr, alloc: alloc }; + let weak = Weak { ptr: init_ptr, alloc }; // It's important we don't give up ownership of the weak pointer, or // else the memory might be freed by the time `data_fn` returns. If diff --git a/library/alloc/src/sync.rs b/library/alloc/src/sync.rs index 6cf41a3fa4e..9be0b3e3e88 100644 --- a/library/alloc/src/sync.rs +++ b/library/alloc/src/sync.rs @@ -784,7 +784,7 @@ impl<T, A: Allocator> Arc<T, A> { let uninit_ptr: NonNull<_> = (unsafe { &mut *uninit_raw_ptr }).into(); let init_ptr: NonNull<ArcInner<T>> = uninit_ptr.cast(); - let weak = Weak { ptr: init_ptr, alloc: alloc }; + let weak = Weak { ptr: init_ptr, alloc }; // It's important we don't give up ownership of the weak pointer, or // else the memory might be freed by the time `data_fn` returns. If |
