Rollup merge of #131778 - practicalrs:fix_needless_lifetimes, r=jieyouxu

Fix needless_lifetimes in stable_mir

Hi,

This PR fixes the following clippy warning

```
warning: the following explicit lifetimes could be elided: 'a
   --> compiler/stable_mir/src/mir/visit.rs:490:6
    |
490 | impl<'a> PlaceRef<'a> {
    |      ^^           ^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    = note: `#[warn(clippy::needless_lifetimes)]` on by default
help: elide the lifetimes
    |
490 - impl<'a> PlaceRef<'a> {
490 + impl PlaceRef<'_> {
    |
```

Best regards,
Michal
This commit is contained in:
Matthias Krüger 2024-10-16 20:15:56 +02:00 committed by GitHub
commit 50e93bc080
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -477,7 +477,7 @@ pub struct PlaceRef<'a> {
pub projection: &'a [ProjectionElem], pub projection: &'a [ProjectionElem],
} }
impl<'a> PlaceRef<'a> { impl PlaceRef<'_> {
/// Get the type of this place. /// Get the type of this place.
pub fn ty(&self, locals: &[LocalDecl]) -> Result<Ty, Error> { pub fn ty(&self, locals: &[LocalDecl]) -> Result<Ty, Error> {
self.projection.iter().fold(Ok(locals[self.local].ty), |place_ty, elem| elem.ty(place_ty?)) self.projection.iter().fold(Ok(locals[self.local].ty), |place_ty, elem| elem.ty(place_ty?))