From fb971c3bce710df234feb313528da81ccd5e26f9 Mon Sep 17 00:00:00 2001 From: veetaha Date: Tue, 2 Jun 2020 02:50:05 +0300 Subject: Simplify --- crates/ra_syntax/src/ast.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/ra_syntax/src/ast.rs') diff --git a/crates/ra_syntax/src/ast.rs b/crates/ra_syntax/src/ast.rs index 1876afe95..eddc807d5 100644 --- a/crates/ra_syntax/src/ast.rs +++ b/crates/ra_syntax/src/ast.rs @@ -75,7 +75,7 @@ impl AstChildren { impl Iterator for AstChildren { type Item = N; fn next(&mut self) -> Option { - self.inner.by_ref().find_map(N::cast) + self.inner.find_map(N::cast) } } -- cgit v1.2.3 From 506e1ddbfa5213f254923da9bbf0efddc6f1fc34 Mon Sep 17 00:00:00 2001 From: Matthew Jasper Date: Wed, 10 Jun 2020 11:30:48 +0100 Subject: Separating parsing of `for` in predicates and types --- crates/ra_syntax/src/ast.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'crates/ra_syntax/src/ast.rs') diff --git a/crates/ra_syntax/src/ast.rs b/crates/ra_syntax/src/ast.rs index eddc807d5..9d02aeef3 100644 --- a/crates/ra_syntax/src/ast.rs +++ b/crates/ra_syntax/src/ast.rs @@ -285,6 +285,8 @@ where let pred = predicates.next().unwrap(); let mut bounds = pred.type_bound_list().unwrap().bounds(); + assert!(pred.for_token().is_none()); + assert!(pred.type_param_list().is_none()); assert_eq!("T", pred.type_ref().unwrap().syntax().text().to_string()); assert_bound("Clone", bounds.next()); assert_bound("Copy", bounds.next()); @@ -322,6 +324,8 @@ where let pred = predicates.next().unwrap(); let mut bounds = pred.type_bound_list().unwrap().bounds(); - assert_eq!("for<'a> F", pred.type_ref().unwrap().syntax().text().to_string()); + assert!(pred.for_token().is_some()); + assert_eq!("<'a>", pred.type_param_list().unwrap().syntax().text().to_string()); + assert_eq!("F", pred.type_ref().unwrap().syntax().text().to_string()); assert_bound("Fn(&'a str)", bounds.next()); } -- cgit v1.2.3