Skip to content

Commit

Permalink
Clippy fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
g-r-a-n-t committed Oct 1, 2021
1 parent 4d5bc24 commit 7b05ac4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion crates/parser/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ impl fmt::Display for Path {
let joined_names = self
.names
.iter()
.map(|name| format!("{}", name.kind))
.map(|name| name.kind.to_string())
.collect::<Vec<_>>()
.join("::");
write!(f, "{}", joined_names)?;
Expand Down
24 changes: 11 additions & 13 deletions crates/parser/src/grammar/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,23 +169,21 @@ pub fn parse_use_tree(par: &mut Parser) -> ParseResult<Node<UseTree>> {
"failed to parse `use` tree",
vec!["Note: expected a `*`, `{` or name token".to_string()],
);
return Err(ParseFailed);
Err(ParseFailed)
}
}
} else {
if par.peek() == Some(TokenKind::As) {
par.next()?;
} else if par.peek() == Some(TokenKind::As) {
par.next()?;

let rename_tok = par.expect(TokenKind::Name, "failed to parse `use` tree")?;
let rename = Some(Node::new(rename_tok.text.to_string(), rename_tok.span));
let rename_tok = par.expect(TokenKind::Name, "failed to parse `use` tree")?;
let rename = Some(Node::new(rename_tok.text.to_string(), rename_tok.span));

Ok(Node::new(
UseTree::Simple { path, rename },
path_span + rename_tok.span,
))
} else {
Ok(Node::new(UseTree::Simple { path, rename: None }, path_span))
}
Ok(Node::new(
UseTree::Simple { path, rename },
path_span + rename_tok.span,
))
} else {
Ok(Node::new(UseTree::Simple { path, rename: None }, path_span))
}
}

Expand Down

0 comments on commit 7b05ac4

Please sign in to comment.