mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
Address review comments.
This commit is contained in:
parent
416399dc10
commit
37fbd91eb5
@ -475,7 +475,7 @@ macro_rules! implement_ty_decoder {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn read_raw_bytes_into(&mut self, bytes: &mut [u8]) -> () {
|
||||
fn read_raw_bytes_into(&mut self, bytes: &mut [u8]) {
|
||||
self.opaque.read_raw_bytes_into(bytes)
|
||||
}
|
||||
}
|
||||
|
@ -2792,9 +2792,9 @@ impl<T, R> InternIteratorElement<T, R> for T {
|
||||
) -> Self::Output {
|
||||
// This code is hot enough that it's worth specializing for the most
|
||||
// common length lists, to avoid the overhead of `SmallVec` creation.
|
||||
// Lengths 0, 1, and 2 typically account for ~95% of cases. We assume
|
||||
// that if the upper and lower bounds from `size_hint` agree they are
|
||||
// correct.
|
||||
// Lengths 0, 1, and 2 typically account for ~95% of cases. If
|
||||
// `size_hint` is incorrect a panic will occur via an `unwrap` or an
|
||||
// `assert`.
|
||||
match iter.size_hint() {
|
||||
(0, Some(0)) => {
|
||||
assert!(iter.next().is_none());
|
||||
@ -2835,9 +2835,10 @@ impl<T, R, E> InternIteratorElement<T, R> for Result<T, E> {
|
||||
) -> Self::Output {
|
||||
// This code is hot enough that it's worth specializing for the most
|
||||
// common length lists, to avoid the overhead of `SmallVec` creation.
|
||||
// Lengths 0, 1, and 2 typically account for ~95% of cases. We assume
|
||||
// that if the upper and lower bounds from `size_hint` agree they are
|
||||
// correct.
|
||||
// Lengths 0, 1, and 2 typically account for ~95% of cases. If
|
||||
// `size_hint` is incorrect a panic will occur via an `unwrap` or an
|
||||
// `assert`, unless a failure happens first, in which case the result
|
||||
// will be an error anyway.
|
||||
Ok(match iter.size_hint() {
|
||||
(0, Some(0)) => {
|
||||
assert!(iter.next().is_none());
|
||||
|
@ -142,7 +142,6 @@ impl<'a, K: DepKind + Decodable<opaque::Decoder<'a>>> Decodable<opaque::Decoder<
|
||||
let end = edge_list_data.len().try_into().unwrap();
|
||||
let _i: SerializedDepNodeIndex = edge_list_indices.push((start, end));
|
||||
debug_assert_eq!(_i.index(), _index);
|
||||
()
|
||||
})
|
||||
})
|
||||
});
|
||||
|
@ -2296,7 +2296,6 @@ impl crate::Decoder for Decoder {
|
||||
for c in s.iter_mut() {
|
||||
*c = self.read_u8();
|
||||
}
|
||||
()
|
||||
}
|
||||
|
||||
fn read_enum<T, F>(&mut self, f: F) -> T
|
||||
|
@ -676,11 +676,10 @@ impl<'a> serialize::Decoder for Decoder<'a> {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn read_raw_bytes_into(&mut self, s: &mut [u8]) -> () {
|
||||
fn read_raw_bytes_into(&mut self, s: &mut [u8]) {
|
||||
let start = self.position;
|
||||
self.position += s.len();
|
||||
s.copy_from_slice(&self.data[start..self.position]);
|
||||
()
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user