Closed
Description
https://github.com/rust-lang/rust/blob/master/src/libsyntax/ast_util.rs
Things like
pub fn stmt_id(s: &Stmt) -> Option<NodeId>
should instead be
impl Stmt {
pub fn id(s: &Stmt) -> Option<NodeId> {..}
}
The same goes for many other functions that take their first argument as an AST type (BinOp, Stmt, IntTy, Path, Ident, etc. Similarly, functions like these could be Generics::empty()
instead.
(Feel free to keep it in the same file or move it to ast.rs)