@@ -107,8 +107,8 @@ where
107107 /// ```
108108 fn add_assign ( & mut self , dist : T ) {
109109 match self . strand {
110- ReqStrand :: Forward => self . pos += dist. into ( ) ,
111- ReqStrand :: Reverse => self . pos -= dist. into ( ) ,
110+ ReqStrand :: Forward => self . pos += dist,
111+ ReqStrand :: Reverse => self . pos -= dist,
112112 }
113113 }
114114}
@@ -138,8 +138,8 @@ where
138138 /// ```
139139 fn sub_assign ( & mut self , dist : T ) {
140140 match self . strand {
141- ReqStrand :: Forward => self . pos -= dist. into ( ) ,
142- ReqStrand :: Reverse => self . pos += dist. into ( ) ,
141+ ReqStrand :: Forward => self . pos -= dist,
142+ ReqStrand :: Reverse => self . pos += dist,
143143 }
144144 }
145145}
@@ -169,9 +169,7 @@ impl<R, S> Loc for Pos<R, S> {
169169 Self :: Strand : Into < ReqStrand > + Copy ,
170170 T : Neg < Output = T > + Copy ,
171171 {
172- if self . refid != pos. refid {
173- None
174- } else if self . pos != pos. pos {
172+ if ( self . refid != pos. refid ) || ( self . pos != pos. pos ) {
175173 None
176174 } else {
177175 Some ( Pos :: new (
@@ -252,21 +250,17 @@ where
252250 static ref POS_RE : Regex = Regex :: new( r"^(.*):(\d+)(\([+-]\))?$" ) . unwrap( ) ;
253251 }
254252
255- let cap = POS_RE
256- . captures ( s)
257- . ok_or_else ( || ParseAnnotError :: BadAnnot ) ?;
253+ let cap = POS_RE . captures ( s) . ok_or ( ParseAnnotError :: BadAnnot ) ?;
258254
259255 let strand = cap
260256 . get ( 3 )
261257 . map_or ( "" , |m| m. as_str ( ) )
262258 . parse :: < S > ( )
263- . map_err ( |e| ParseAnnotError :: ParseStrand ( e ) ) ?;
259+ . map_err ( ParseAnnotError :: ParseStrand ) ?;
264260
265261 Ok ( Pos :: new (
266262 R :: from ( cap[ 1 ] . to_owned ( ) ) ,
267- cap[ 2 ]
268- . parse :: < isize > ( )
269- . map_err ( |e| ParseAnnotError :: ParseInt ( e) ) ?,
263+ cap[ 2 ] . parse :: < isize > ( ) . map_err ( ParseAnnotError :: ParseInt ) ?,
270264 strand,
271265 ) )
272266 }
0 commit comments