To write another lint in Rust, I need to make sure that the Expr type is actually Option<_> (or any pointer to one). I already went through any ptr and rptr to their conclusion and stayed with rustc::middle::ty , which in my test example debugs (manually formatted for better readability):
TyS { sty: ty_enum( DefId { krate: 2, node: 117199 }, Substs { types: VecPerParamSpace { TypeSpace: [ TyS { sty: ty_int(i32), flags: 0, region_depth: 0 } ], SelfSpace: [], FnSpace: [], }, regions: NonerasedRegions( VecPerParamSpace { TypeSpace: [], SelfSpace: [], FnSpace: [], } ) } ), flags: 0, region_depth: 0 }
However, now I am a little lost - how do I know if TyS is really an Option <_> type?
source share