diff --git a/compiler/rustc_middle/src/ty/codec.rs b/compiler/rustc_middle/src/ty/codec.rs index 4cd3b5e7a50..65b91eedf8a 100644 --- a/compiler/rustc_middle/src/ty/codec.rs +++ b/compiler/rustc_middle/src/ty/codec.rs @@ -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) } } diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index acc115e48a4..3e619b30ea5 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -2792,9 +2792,9 @@ impl InternIteratorElement 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 InternIteratorElement for Result { ) -> 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()); diff --git a/compiler/rustc_query_system/src/dep_graph/serialized.rs b/compiler/rustc_query_system/src/dep_graph/serialized.rs index 2fc626a75b3..283eda7c85e 100644 --- a/compiler/rustc_query_system/src/dep_graph/serialized.rs +++ b/compiler/rustc_query_system/src/dep_graph/serialized.rs @@ -142,7 +142,6 @@ impl<'a, K: DepKind + Decodable>> Decodable(&mut self, f: F) -> T diff --git a/compiler/rustc_serialize/src/opaque.rs b/compiler/rustc_serialize/src/opaque.rs index 89ac7834a39..c272c687a7e 100644 --- a/compiler/rustc_serialize/src/opaque.rs +++ b/compiler/rustc_serialize/src/opaque.rs @@ -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]); - () } }