aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_fmt
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-04-13 16:25:17 +0100
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-04-13 16:25:17 +0100
commit23b876bc3b00c53ce24b8a99b4f4bf190fc6300e (patch)
tree632767346f695b6a2d547997c452070dc1f39dca /crates/ra_fmt
parent8887782c4ab97d22f3d5c10e142407e4371c5c61 (diff)
parent6aae0cf7fa042d51e97c7606cdf3a338f172f7d2 (diff)
Merge #1143
1143: replace usages of `algo::generate` with `iter::successors` from std r=matklad a=Robbepop Implements #1136 Co-authored-by: Robin Freyler <[email protected]>
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> {