aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_fmt
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_fmt')
-rw-r--r--crates/ra_fmt/src/lib.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/crates/ra_fmt/src/lib.rs b/crates/ra_fmt/src/lib.rs
index 85b7ce250..603be1854 100644
--- a/crates/ra_fmt/src/lib.rs
+++ b/crates/ra_fmt/src/lib.rs
@@ -1,10 +1,10 @@
1//! This crate provides some utilities for indenting rust code. 1//! This crate provides some utilities for indenting rust code.
2//! 2//!
3use std::iter::successors;
3use itertools::Itertools; 4use itertools::Itertools;
4use ra_syntax::{ 5use ra_syntax::{
5 SyntaxNode, SyntaxKind::*, SyntaxToken, SyntaxKind, 6 SyntaxNode, SyntaxKind::*, SyntaxToken, SyntaxKind,
6 ast::{self, AstNode, AstToken}, 7 ast::{self, AstNode, AstToken},
7 algo::generate,
8}; 8};
9 9
10pub fn reindent(text: &str, indent: &str) -> String { 10pub fn reindent(text: &str, indent: &str) -> String {
@@ -29,7 +29,7 @@ pub fn leading_indent(node: &SyntaxNode) -> Option<&str> {
29} 29}
30 30
31fn prev_tokens(token: SyntaxToken) -> impl Iterator<Item = SyntaxToken> { 31fn prev_tokens(token: SyntaxToken) -> impl Iterator<Item = SyntaxToken> {
32 generate(token.prev_token(), |&token| token.prev_token()) 32 successors(token.prev_token(), |&token| token.prev_token())
33} 33}
34 34
35pub fn extract_trivial_expression(block: &ast::Block) -> Option<&ast::Expr> { 35pub fn extract_trivial_expression(block: &ast::Block) -> Option<&ast::Expr> {