diff options
author | Robin Freyler <[email protected]> | 2019-04-13 15:43:49 +0100 |
---|---|---|
committer | Robin Freyler <[email protected]> | 2019-04-13 15:43:49 +0100 |
commit | 6aae0cf7fa042d51e97c7606cdf3a338f172f7d2 (patch) | |
tree | 632767346f695b6a2d547997c452070dc1f39dca /crates/ra_syntax/src/algo.rs | |
parent | 8887782c4ab97d22f3d5c10e142407e4371c5c61 (diff) |
replace usages of `algo::generate` with `iter::successors` from std
Diffstat (limited to 'crates/ra_syntax/src/algo.rs')
-rw-r--r-- | crates/ra_syntax/src/algo.rs | 10 |
1 files changed, 0 insertions, 10 deletions
diff --git a/crates/ra_syntax/src/algo.rs b/crates/ra_syntax/src/algo.rs index 06b45135c..1f68fe467 100644 --- a/crates/ra_syntax/src/algo.rs +++ b/crates/ra_syntax/src/algo.rs | |||
@@ -46,13 +46,3 @@ pub fn non_trivia_sibling(element: SyntaxElement, direction: Direction) -> Optio | |||
46 | pub fn find_covering_element(root: &SyntaxNode, range: TextRange) -> SyntaxElement { | 46 | pub fn find_covering_element(root: &SyntaxNode, range: TextRange) -> SyntaxElement { |
47 | root.0.covering_node(range).into() | 47 | root.0.covering_node(range).into() |
48 | } | 48 | } |
49 | |||
50 | // Replace with `std::iter::successors` in `1.34.0` | ||
51 | pub fn generate<T>(seed: Option<T>, step: impl Fn(&T) -> Option<T>) -> impl Iterator<Item = T> { | ||
52 | ::itertools::unfold(seed, move |slot| { | ||
53 | slot.take().map(|curr| { | ||
54 | *slot = step(&curr); | ||
55 | curr | ||
56 | }) | ||
57 | }) | ||
58 | } | ||