Skip to content

Make some of the ast_util functions into methods #30058

Closed
@Manishearth

Description

@Manishearth

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)

Metadata

Metadata

Assignees

Labels

E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-help-wantedCall for participation: Help is requested to fix this issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions