Skip to content

Instantly share code, notes, and snippets.

View QuietMisdreavus's full-sized avatar

QuietMisdreavus QuietMisdreavus

View GitHub Profile
Item {
source: Span {
filename: Real("src/lib.rs"),
loline: 1,
locol: 0,
hiline: 2,
hicol: 23
},
name: Some(""),
attrs: Attributes {
pub fn get_pattern_source(&self, pat: &Pat) -> Option<PatternSource<'hir>> {
let id = // get id
match self.find(id) {
Some(NodeExpr(ref e)) => {
Some(PatternSource::MatchExpr(e))
}
Some(NodeStmt(&Stmt { node: StmtDecl(ref decl, _), .. })) => {
match decl.clone().unwrap().node {
DeclLocal(ref local) => Some(PatternSource::LetDecl(local)),
_ => {