@@ -35,11 +35,9 @@ use syntax::ast::{NodeId, CRATE_NODE_ID, Ident, Name, Attribute};
3535use syntax_pos:: Span ;
3636use hir:: * ;
3737use hir:: def:: Def ;
38- use hir:: map:: { self , Map } ;
38+ use hir:: map:: Map ;
3939use super :: itemlikevisit:: DeepVisitor ;
4040
41- use std:: cmp;
42-
4341#[ derive( Copy , Clone ) ]
4442pub enum FnKind < ' a > {
4543 /// `#[xxx] pub async/const/extern "Abi" fn foo()`
@@ -1133,57 +1131,3 @@ pub fn walk_defaultness<'v, V: Visitor<'v>>(_: &mut V, _: &'v Defaultness) {
11331131 // the right thing to do, should content be added in the future,
11341132 // would be to walk it.
11351133}
1136-
1137- #[ derive( Copy , Clone , RustcEncodable , RustcDecodable , Debug ) ]
1138- pub struct IdRange {
1139- pub min : NodeId ,
1140- pub max : NodeId ,
1141- }
1142-
1143- impl IdRange {
1144- pub fn max ( ) -> IdRange {
1145- IdRange {
1146- min : NodeId :: MAX ,
1147- max : NodeId :: from_u32 ( 0 ) ,
1148- }
1149- }
1150-
1151- pub fn empty ( & self ) -> bool {
1152- self . min >= self . max
1153- }
1154-
1155- pub fn contains ( & self , id : NodeId ) -> bool {
1156- id >= self . min && id < self . max
1157- }
1158-
1159- pub fn add ( & mut self , id : NodeId ) {
1160- self . min = cmp:: min ( self . min , id) ;
1161- self . max = cmp:: max ( self . max , NodeId :: from_u32 ( id. as_u32 ( ) + 1 ) ) ;
1162- }
1163- }
1164-
1165-
1166- pub struct IdRangeComputingVisitor < ' a , ' hir : ' a > {
1167- result : IdRange ,
1168- map : & ' a map:: Map < ' hir > ,
1169- }
1170-
1171- impl < ' a , ' hir > IdRangeComputingVisitor < ' a , ' hir > {
1172- pub fn new ( map : & ' a map:: Map < ' hir > ) -> IdRangeComputingVisitor < ' a , ' hir > {
1173- IdRangeComputingVisitor { result : IdRange :: max ( ) , map : map }
1174- }
1175-
1176- pub fn result ( & self ) -> IdRange {
1177- self . result
1178- }
1179- }
1180-
1181- impl < ' a , ' hir > Visitor < ' hir > for IdRangeComputingVisitor < ' a , ' hir > {
1182- fn nested_visit_map < ' this > ( & ' this mut self ) -> NestedVisitorMap < ' this , ' hir > {
1183- NestedVisitorMap :: OnlyBodies ( & self . map )
1184- }
1185-
1186- fn visit_id ( & mut self , id : NodeId ) {
1187- self . result . add ( id) ;
1188- }
1189- }
0 commit comments