Skip to content

Commit 4822feb

Browse files
CoAlloc: tidy
1 parent 89e6170 commit 4822feb

File tree

3 files changed

+18
-12
lines changed

3 files changed

+18
-12
lines changed

library/alloc/src/collections/vec_deque/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -609,11 +609,10 @@ where
609609
{
610610
/// Coallocation-aware version of `new`.
611611
#[inline]
612-
#[unstable(feature = "co_alloc_global", issue="none")]
612+
#[unstable(feature = "co_alloc_global", issue = "none")]
613613
#[must_use]
614614
#[allow(unused_braces)]
615-
pub const fn new_co() -> VecDeque<T, Global, CO_ALLOC_PREF>
616-
{
615+
pub const fn new_co() -> VecDeque<T, Global, CO_ALLOC_PREF> {
617616
// FIXME: This should just be `VecDeque::new_in(Global)` once that hits stable.
618617
VecDeque { head: 0, len: 0, buf: RawVec::NEW }
619618
}

library/alloc/src/slice.rs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,15 +1004,19 @@ impl<T: Copy, A: Allocator> SpecCloneIntoVec<T, A> for [T] {
10041004
#[cfg(not(no_global_oom_handling))]
10051005
#[allow(unused_braces)]
10061006
pub(crate) trait SpecCloneIntoVecCo<T, A: Allocator, const CO_ALLOC_PREF: CoAllocPref>
1007-
where [(); { crate::meta_num_slots!(A, CO_ALLOC_PREF) }]:,
1008-
{
1007+
where
1008+
[(); { crate::meta_num_slots!(A, CO_ALLOC_PREF) }]:,
1009+
{
10091010
fn clone_into_co(&self, target: &mut Vec<T, A, CO_ALLOC_PREF>);
10101011
}
10111012

10121013
#[cfg(not(no_global_oom_handling))]
10131014
#[allow(unused_braces)]
1014-
impl<T: Clone, A: Allocator, const CO_ALLOC_PREF: CoAllocPref> SpecCloneIntoVecCo<T, A, CO_ALLOC_PREF> for [T]
1015-
where [(); { crate::meta_num_slots!(A, CO_ALLOC_PREF) }]:, {
1015+
impl<T: Clone, A: Allocator, const CO_ALLOC_PREF: CoAllocPref>
1016+
SpecCloneIntoVecCo<T, A, CO_ALLOC_PREF> for [T]
1017+
where
1018+
[(); { crate::meta_num_slots!(A, CO_ALLOC_PREF) }]:,
1019+
{
10161020
default fn clone_into_co(&self, target: &mut Vec<T, A, CO_ALLOC_PREF>) {
10171021
// drop anything in target that will not be overwritten
10181022
target.truncate(self.len());
@@ -1029,15 +1033,17 @@ where [(); { crate::meta_num_slots!(A, CO_ALLOC_PREF) }]:, {
10291033

10301034
#[cfg(not(no_global_oom_handling))]
10311035
#[allow(unused_braces)]
1032-
impl<T: Copy, A: Allocator, const CO_ALLOC_PREF: CoAllocPref> SpecCloneIntoVecCo<T, A, CO_ALLOC_PREF> for [T]
1033-
where [(); { crate::meta_num_slots!(A, CO_ALLOC_PREF) }]:, {
1036+
impl<T: Copy, A: Allocator, const CO_ALLOC_PREF: CoAllocPref>
1037+
SpecCloneIntoVecCo<T, A, CO_ALLOC_PREF> for [T]
1038+
where
1039+
[(); { crate::meta_num_slots!(A, CO_ALLOC_PREF) }]:,
1040+
{
10341041
fn clone_into_co(&self, target: &mut Vec<T, A, CO_ALLOC_PREF>) {
10351042
target.clear();
10361043
target.extend_from_slice(self);
10371044
}
10381045
}
10391046

1040-
10411047
#[cfg(not(no_global_oom_handling))]
10421048
#[stable(feature = "rust1", since = "1.0.0")]
10431049
impl<T: Clone> ToOwned for [T] {

library/alloc/src/vec/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1879,6 +1879,8 @@ where
18791879
where
18801880
[(); { crate::meta_num_slots!(A, CO_ALLOC_PREF) }]:,
18811881
{
1882+
crate::meta_num_slots!(A, CO_ALLOC_PREF) }]:,
1883+
{
18821884
/* Offset of the element we want to check if it is duplicate */
18831885
read: usize,
18841886

@@ -3332,8 +3334,7 @@ where
33323334
#[stable(feature = "rust1", since = "1.0.0")]
33333335
#[rustc_const_unstable(feature = "const_default_impls", issue = "87864")]
33343336
#[allow(unused_braces)]
3335-
impl<T> const Default for Vec<T>
3336-
{
3337+
impl<T> const Default for Vec<T> {
33373338
/// Creates an empty `Vec<T>`.
33383339
///
33393340
/// The vector will not allocate until elements are pushed onto it.

0 commit comments

Comments
 (0)