Inline Span methods.

Because they are simple and hot.

This change speeds up some incremental runs of a few rustc-perf
benchmarks, the best by 3%.
This commit is contained in:
Nicholas Nethercote 2018-05-09 15:25:44 +10:00
parent f9bfe840f4
commit 77c40f8c6f

View File

@ -31,11 +31,13 @@ pub struct Span(u32);
impl Copy for Span {}
impl Clone for Span {
#[inline]
fn clone(&self) -> Span {
*self
}
}
impl PartialEq for Span {
#[inline]
fn eq(&self, other: &Span) -> bool {
let a = self.0;
let b = other.0;
@ -44,6 +46,7 @@ impl PartialEq for Span {
}
impl Eq for Span {}
impl Hash for Span {
#[inline]
fn hash<H: Hasher>(&self, state: &mut H) {
let a = self.0;
a.hash(state)