mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
replace usages of algo::generate
with iter::successors
from std
This commit is contained in:
parent
8887782c4a
commit
6aae0cf7fa
6 changed files with 17 additions and 24 deletions
|
@ -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> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue