X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Flibrustc_data_structures%2Fsvh.rs;h=476eb9e14f98f34313346ba153f82ac620683a97;hb=6fc73bc10a72d0e4475f8ab60e9902bddc03c1f6;hp=3123c182b0f4cb8058511d7ad54870be2a997224;hpb=88629778e6faeda18409ffaa9a00291e3605bae3;p=rust.git diff --git a/src/librustc_data_structures/svh.rs b/src/librustc_data_structures/svh.rs index 3123c182b0f..476eb9e14f9 100644 --- a/src/librustc_data_structures/svh.rs +++ b/src/librustc_data_structures/svh.rs @@ -5,9 +5,9 @@ //! mismatches where we have two versions of the same crate that were //! compiled from distinct sources. +use rustc_serialize::{Decodable, Decoder, Encodable, Encoder}; use std::fmt; use std::hash::{Hash, Hasher}; -use rustc_serialize::{Encodable, Decodable, Encoder, Decoder}; use crate::stable_hasher; @@ -34,7 +34,10 @@ pub fn to_string(&self) -> String { } impl Hash for Svh { - fn hash(&self, state: &mut H) where H: Hasher { + fn hash(&self, state: &mut H) + where + H: Hasher, + { self.hash.to_le().hash(state); } } @@ -53,22 +56,14 @@ fn encode(&self, s: &mut S) -> Result<(), S::Error> { impl Decodable for Svh { fn decode(d: &mut D) -> Result { - d.read_u64() - .map(u64::from_le) - .map(Svh::new) + d.read_u64().map(u64::from_le).map(Svh::new) } } impl stable_hasher::HashStable for Svh { #[inline] - fn hash_stable( - &self, - ctx: &mut T, - hasher: &mut stable_hasher::StableHasher - ) { - let Svh { - hash - } = *self; + fn hash_stable(&self, ctx: &mut T, hasher: &mut stable_hasher::StableHasher) { + let Svh { hash } = *self; hash.hash_stable(ctx, hasher); } }