Minor iterator changes
This commit is contained in:
@@ -379,16 +379,12 @@ mod tests {
|
||||
impl UseDefMap<'_> {
|
||||
fn first_public_binding(&self, symbol: ScopedSymbolId) -> Option<Definition<'_>> {
|
||||
self.public_bindings(symbol)
|
||||
.map(|constrained_binding| constrained_binding.binding)
|
||||
.find(Option::is_some)
|
||||
.unwrap()
|
||||
.find_map(|constrained_binding| constrained_binding.binding)
|
||||
}
|
||||
|
||||
fn first_binding_at_use(&self, use_id: ScopedUseId) -> Option<Definition<'_>> {
|
||||
self.bindings_at_use(use_id)
|
||||
.map(|constrained_binding| constrained_binding.binding)
|
||||
.find(Option::is_some)
|
||||
.unwrap()
|
||||
.find_map(|constrained_binding| constrained_binding.binding)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -392,7 +392,7 @@ fn declarations_ty<'db>(
|
||||
let mut conflicting: Vec<Type<'db>> = vec![];
|
||||
let declared_ty = if let Some(second) = types.next() {
|
||||
let mut builder = UnionBuilder::new(db).add(first);
|
||||
for other in [second].into_iter().chain(types) {
|
||||
for other in std::iter::once(second).chain(types) {
|
||||
if !first.is_equivalent_to(db, other) {
|
||||
conflicting.push(other);
|
||||
}
|
||||
@@ -415,7 +415,7 @@ fn declarations_ty<'db>(
|
||||
} else {
|
||||
Err((
|
||||
declared_ty,
|
||||
[first].into_iter().chain(conflicting).collect(),
|
||||
std::iter::once(first).chain(conflicting).collect(),
|
||||
))
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user