replace usages of algo::generate with iter::successors from std

This commit is contained in:
Robin Freyler 2019-04-13 16:43:49 +02:00
parent 8887782c4a
commit 6aae0cf7fa
No known key found for this signature in database
GPG key ID: 1949800ACC8CE89B
6 changed files with 17 additions and 24 deletions

View file

@ -1,10 +1,10 @@
//! This crate provides some utilities for indenting rust code.
//!
use std::iter::successors;
use itertools::Itertools;
use ra_syntax::{
SyntaxNode, SyntaxKind::*, SyntaxToken, SyntaxKind,
ast::{self, AstNode, AstToken},
algo::generate,
};
pub fn reindent(text: &str, indent: &str) -> String {
@ -29,7 +29,7 @@ pub fn leading_indent(node: &SyntaxNode) -> Option<&str> {
}
fn prev_tokens(token: SyntaxToken) -> impl Iterator<Item = SyntaxToken> {
generate(token.prev_token(), |&token| token.prev_token())
successors(token.prev_token(), |&token| token.prev_token())
}
pub fn extract_trivial_expression(block: &ast::Block) -> Option<&ast::Expr> {