mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-08-04 10:50:15 +00:00
Don't compare ast::Visibility by stringifying
This commit is contained in:
parent
8bb37737c9
commit
da7f1eb756
4 changed files with 74 additions and 6 deletions
|
@ -140,6 +140,34 @@ impl JodChild {
|
|||
}
|
||||
}
|
||||
|
||||
// feature: iter_order_by
|
||||
// Iterator::eq_by
|
||||
pub fn iter_eq_by<I, I2, F>(this: I2, other: I, mut eq: F) -> bool
|
||||
where
|
||||
I: IntoIterator,
|
||||
I2: IntoIterator,
|
||||
F: FnMut(I2::Item, I::Item) -> bool,
|
||||
{
|
||||
let mut other = other.into_iter();
|
||||
let mut this = this.into_iter();
|
||||
|
||||
loop {
|
||||
let x = match this.next() {
|
||||
None => return other.next().is_none(),
|
||||
Some(val) => val,
|
||||
};
|
||||
|
||||
let y = match other.next() {
|
||||
None => return false,
|
||||
Some(val) => val,
|
||||
};
|
||||
|
||||
if !eq(x, y) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue