Skip to content

Commit 37fbd91

Browse files
committed
Address review comments.
1 parent 416399d commit 37fbd91

File tree

5 files changed

+9
-11
lines changed

5 files changed

+9
-11
lines changed

compiler/rustc_middle/src/ty/codec.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ macro_rules! implement_ty_decoder {
475475
}
476476

477477
#[inline]
478-
fn read_raw_bytes_into(&mut self, bytes: &mut [u8]) -> () {
478+
fn read_raw_bytes_into(&mut self, bytes: &mut [u8]) {
479479
self.opaque.read_raw_bytes_into(bytes)
480480
}
481481
}

compiler/rustc_middle/src/ty/context.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -2792,9 +2792,9 @@ impl<T, R> InternIteratorElement<T, R> for T {
27922792
) -> Self::Output {
27932793
// This code is hot enough that it's worth specializing for the most
27942794
// common length lists, to avoid the overhead of `SmallVec` creation.
2795-
// Lengths 0, 1, and 2 typically account for ~95% of cases. We assume
2796-
// that if the upper and lower bounds from `size_hint` agree they are
2797-
// correct.
2795+
// Lengths 0, 1, and 2 typically account for ~95% of cases. If
2796+
// `size_hint` is incorrect a panic will occur via an `unwrap` or an
2797+
// `assert`.
27982798
match iter.size_hint() {
27992799
(0, Some(0)) => {
28002800
assert!(iter.next().is_none());
@@ -2835,9 +2835,10 @@ impl<T, R, E> InternIteratorElement<T, R> for Result<T, E> {
28352835
) -> Self::Output {
28362836
// This code is hot enough that it's worth specializing for the most
28372837
// common length lists, to avoid the overhead of `SmallVec` creation.
2838-
// Lengths 0, 1, and 2 typically account for ~95% of cases. We assume
2839-
// that if the upper and lower bounds from `size_hint` agree they are
2840-
// correct.
2838+
// Lengths 0, 1, and 2 typically account for ~95% of cases. If
2839+
// `size_hint` is incorrect a panic will occur via an `unwrap` or an
2840+
// `assert`, unless a failure happens first, in which case the result
2841+
// will be an error anyway.
28412842
Ok(match iter.size_hint() {
28422843
(0, Some(0)) => {
28432844
assert!(iter.next().is_none());

compiler/rustc_query_system/src/dep_graph/serialized.rs

-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ impl<'a, K: DepKind + Decodable<opaque::Decoder<'a>>> Decodable<opaque::Decoder<
142142
let end = edge_list_data.len().try_into().unwrap();
143143
let _i: SerializedDepNodeIndex = edge_list_indices.push((start, end));
144144
debug_assert_eq!(_i.index(), _index);
145-
()
146145
})
147146
})
148147
});

compiler/rustc_serialize/src/json.rs

-1
Original file line numberDiff line numberDiff line change
@@ -2296,7 +2296,6 @@ impl crate::Decoder for Decoder {
22962296
for c in s.iter_mut() {
22972297
*c = self.read_u8();
22982298
}
2299-
()
23002299
}
23012300

23022301
fn read_enum<T, F>(&mut self, f: F) -> T

compiler/rustc_serialize/src/opaque.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -676,11 +676,10 @@ impl<'a> serialize::Decoder for Decoder<'a> {
676676
}
677677

678678
#[inline]
679-
fn read_raw_bytes_into(&mut self, s: &mut [u8]) -> () {
679+
fn read_raw_bytes_into(&mut self, s: &mut [u8]) {
680680
let start = self.position;
681681
self.position += s.len();
682682
s.copy_from_slice(&self.data[start..self.position]);
683-
()
684683
}
685684
}
686685

0 commit comments

Comments
 (0)