1
Fork 0

Avoid Iterator::last

This commit is contained in:
KaDiWa 2022-09-11 17:23:00 +02:00
parent 6f0c4a6c5c
commit 66211d83f9
No known key found for this signature in database
GPG key ID: 0B52AE391C674CE5
7 changed files with 11 additions and 15 deletions

View file

@ -617,9 +617,9 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
.filter(|&sp| sp != base_error.span)
.collect();
let start_span = bounds.iter().map(|bound| bound.span()).next().unwrap();
let start_span = bounds[0].span();
// `end_span` is the end of the poly trait ref (Foo + 'baz + Bar><)
let end_span = bounds.iter().map(|bound| bound.span()).last().unwrap();
let end_span = bounds.last().unwrap().span();
// `last_bound_span` is the last bound of the poly trait ref (Foo + >'baz< + Bar)
let last_bound_span = spans.last().cloned().unwrap();
let mut multi_span: MultiSpan = spans.clone().into();