Skip to content

Commit d3ba85e

Browse files
committed
Apply upstream rustfmt formatting via check_rustc.sh --bless
1 parent 3387207 commit d3ba85e

3 files changed

Lines changed: 7 additions & 31 deletions

File tree

library/alloc/src/vec/extract_if.rs

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,7 @@ impl<'a, T, F, A: Allocator> ExtractIf<'a, T, F, A> {
4545
unsafe {
4646
vec.set_len(0);
4747
}
48-
ExtractIf {
49-
vec,
50-
idx: start,
51-
del: 0,
52-
end,
53-
old_len,
54-
pred,
55-
}
48+
ExtractIf { vec, idx: start, del: 0, end, old_len, pred }
5649
}
5750

5851
/// Returns a reference to the underlying allocator.
@@ -136,14 +129,8 @@ where
136129
A: Allocator,
137130
{
138131
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
139-
let peek = if self.idx < self.end {
140-
self.vec.get(self.idx)
141-
} else {
142-
None
143-
};
144-
f.debug_struct("ExtractIf")
145-
.field("peek", &peek)
146-
.finish_non_exhaustive()
132+
let peek = if self.idx < self.end { self.vec.get(self.idx) } else { None };
133+
f.debug_struct("ExtractIf").field("peek", &peek).finish_non_exhaustive()
147134
}
148135
}
149136

library/alloc/src/vec/into_iter.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -484,9 +484,7 @@ where
484484
#[stable(feature = "vec_into_iter_clone", since = "1.8.0")]
485485
impl<T: Clone, A: Allocator + Clone> Clone for IntoIter<T, A> {
486486
fn clone(&self) -> Self {
487-
self.as_slice()
488-
.to_vec_in(self.alloc.deref().clone())
489-
.into_iter()
487+
self.as_slice().to_vec_in(self.alloc.deref().clone()).into_iter()
490488
}
491489
}
492490

library/alloc/src/vec/spec_from_elem.rs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@ impl<T: Clone + IsZero> SpecFromElem for T {
2121
#[inline]
2222
default fn from_elem<A: Allocator>(elem: T, n: usize, alloc: A) -> Vec<T, A> {
2323
if elem.is_zero() {
24-
return Vec {
25-
buf: RawVec::with_capacity_zeroed_in(n, alloc),
26-
len: n,
27-
};
24+
return Vec { buf: RawVec::with_capacity_zeroed_in(n, alloc), len: n };
2825
}
2926
let mut v = Vec::with_capacity_in(n, alloc);
3027
v.extend_with(n, elem);
@@ -36,10 +33,7 @@ impl SpecFromElem for i8 {
3633
#[inline]
3734
fn from_elem<A: Allocator>(elem: i8, n: usize, alloc: A) -> Vec<i8, A> {
3835
if elem == 0 {
39-
return Vec {
40-
buf: RawVec::with_capacity_zeroed_in(n, alloc),
41-
len: n,
42-
};
36+
return Vec { buf: RawVec::with_capacity_zeroed_in(n, alloc), len: n };
4337
}
4438
let mut v = Vec::with_capacity_in(n, alloc);
4539
unsafe {
@@ -54,10 +48,7 @@ impl SpecFromElem for u8 {
5448
#[inline]
5549
fn from_elem<A: Allocator>(elem: u8, n: usize, alloc: A) -> Vec<u8, A> {
5650
if elem == 0 {
57-
return Vec {
58-
buf: RawVec::with_capacity_zeroed_in(n, alloc),
59-
len: n,
60-
};
51+
return Vec { buf: RawVec::with_capacity_zeroed_in(n, alloc), len: n };
6152
}
6253
let mut v = Vec::with_capacity_in(n, alloc);
6354
unsafe {

0 commit comments

Comments
 (0)