1
Fork 0

Rollup merge of #105050 - WaffleLapkin:uselessrefign, r=jyn514

Remove useless borrows and derefs

They are nothing more than noise.
<sub>These are not all of them, but my clippy started crashing (stack overflow), so rip :(</sub>
This commit is contained in:
Matthias Krüger 2022-12-03 17:37:42 +01:00 committed by GitHub
commit 1a2f79b82c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
42 changed files with 157 additions and 158 deletions

View file

@ -247,7 +247,7 @@ fn analyze_source_file_generic(
// The slow path:
// This is either ASCII control character "DEL" or the beginning of
// a multibyte char. Just decode to `char`.
let c = (&src[i..]).chars().next().unwrap();
let c = src[i..].chars().next().unwrap();
char_len = c.len_utf8();
let pos = BytePos::from_usize(i) + output_offset;

View file

@ -165,7 +165,7 @@ impl<'sm> CachingSourceMapView<'sm> {
Some(new_file_and_idx)
} else {
let file = &self.line_cache[oldest].file;
if !file_contains(&file, span_data.hi) {
if !file_contains(file, span_data.hi) {
return None;
}

View file

@ -381,7 +381,7 @@ impl HygieneData {
}
pub fn with<T, F: FnOnce(&mut HygieneData) -> T>(f: F) -> T {
with_session_globals(|session_globals| f(&mut *session_globals.hygiene_data.borrow_mut()))
with_session_globals(|session_globals| f(&mut session_globals.hygiene_data.borrow_mut()))
}
#[inline]

View file

@ -238,7 +238,7 @@ impl RealFileName {
pub fn remapped_path_if_available(&self) -> &Path {
match self {
RealFileName::LocalPath(p)
| RealFileName::Remapped { local_path: _, virtual_name: p } => &p,
| RealFileName::Remapped { local_path: _, virtual_name: p } => p,
}
}

View file

@ -166,5 +166,5 @@ impl SpanInterner {
// If an interner exists, return it. Otherwise, prepare a fresh one.
#[inline]
fn with_span_interner<T, F: FnOnce(&mut SpanInterner) -> T>(f: F) -> T {
crate::with_session_globals(|session_globals| f(&mut *session_globals.span_interner.lock()))
crate::with_session_globals(|session_globals| f(&mut session_globals.span_interner.lock()))
}

View file

@ -1877,7 +1877,7 @@ impl<S: Encoder> Encodable<S> for Symbol {
impl<D: Decoder> Decodable<D> for Symbol {
#[inline]
default fn decode(d: &mut D) -> Symbol {
Symbol::intern(&d.read_str())
Symbol::intern(d.read_str())
}
}