depot/third_party/nixpkgs/pkgs/development/tools/rust/rust-analyzer/no-1-57-map-while.patch
Default email 3cbfd2b52c Project import generated by Copybara.
GitOrigin-RevId: 395879c28386e1abf20c7ecacd45880759548391
2021-12-18 20:06:50 -05:00

20 lines
1.2 KiB
Diff

--- a/crates/ide_db/src/helpers.rs
+++ b/crates/ide_db/src/helpers.rs
@@ -309,7 +309,7 @@ pub fn lint_eq_or_in_group(lint: &str, lint_is: &str) -> bool {
pub fn parse_tt_as_comma_sep_paths(input: ast::TokenTree) -> Option<Vec<ast::Path>> {
let r_paren = input.r_paren_token();
let tokens =
- input.syntax().children_with_tokens().skip(1).map_while(|it| match it.into_token() {
+ input.syntax().children_with_tokens().skip(1).map(|it| match it.into_token() {
// seeing a keyword means the attribute is unclosed so stop parsing here
Some(tok) if tok.kind().is_keyword() => None,
// don't include the right token tree parenthesis if it exists
@@ -317,7 +317,7 @@ pub fn parse_tt_as_comma_sep_paths(input: ast::TokenTree) -> Option<Vec<ast::Pat
// only nodes that we can find are other TokenTrees, those are unexpected in this parse though
None => None,
Some(tok) => Some(tok),
- });
+ }).take_while(|tok| tok.is_some()).map(|tok| tok.unwrap());
let input_expressions = tokens.into_iter().group_by(|tok| tok.kind() == T![,]);
let paths = input_expressions
.into_iter()