Open
Description
rust-analyzer version: 0.4.1810-standalone
rustc version: rustc 1.75.0 (82e1608df 2023-12-21)
relevant settings: None
with this code,
pub struct MyStruct {
value: u64,
}
impl std::hash::Hash for MyStruct {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
self.value.hash(state);
}
}
impl MyStruct {
pub fn as_u64(&self) -> u64 {
self.value
}
}
place the cursor on hash
in self.value.hash(state);
and apply the inline function assist
this is the result:
...
{
let this = &self.value;
let state: &mutH = state;
state.write_u64(*self)
};
...
&mutH
should be&mut H
*self
should be*this
- the first two lines are indented with 4 spaces (normal), but
state.write_u64(*self)
only with 2, this is automatically fixed with the formatter but still doesnt look nice
the cause could be that the Hash
impl for u64
is macro generated, but i dont know exactly