mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
needless_borrow
This commit is contained in:
parent
d351cb8dfb
commit
3839f9a9a2
9 changed files with 14 additions and 15 deletions
|
@ -154,7 +154,7 @@ impl Path {
|
|||
|
||||
pub fn mod_path(&self) -> Option<&ModPath> {
|
||||
match self {
|
||||
Path::Normal { mod_path, .. } => Some(&mod_path),
|
||||
Path::Normal { mod_path, .. } => Some(mod_path),
|
||||
Path::LangItem(..) => None,
|
||||
}
|
||||
}
|
||||
|
@ -219,13 +219,13 @@ impl<'a> PathSegments<'a> {
|
|||
}
|
||||
pub fn skip(&self, len: usize) -> PathSegments<'a> {
|
||||
PathSegments {
|
||||
segments: &self.segments.get(len..).unwrap_or(&[]),
|
||||
segments: self.segments.get(len..).unwrap_or(&[]),
|
||||
generic_args: self.generic_args.and_then(|it| it.get(len..)),
|
||||
}
|
||||
}
|
||||
pub fn take(&self, len: usize) -> PathSegments<'a> {
|
||||
PathSegments {
|
||||
segments: &self.segments.get(..len).unwrap_or(&self.segments),
|
||||
segments: self.segments.get(..len).unwrap_or(self.segments),
|
||||
generic_args: self.generic_args.map(|it| it.get(..len).unwrap_or(it)),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue