@@ -143,7 +143,7 @@ impl Region {
143143 // Sort by length and then content
144144 match a. len ( ) . cmp ( & b. len ( ) ) {
145145 Ordering :: Equal => a. cmp ( b) ,
146- cmp @ _ => cmp
146+ cmp => cmp
147147 }
148148 } ) ;
149149 Some ( idents[ 0 ] . to_owned ( ) )
@@ -188,12 +188,12 @@ impl Region {
188188 . map ( |i| split_keep ( i) )
189189 . collect ( ) ;
190190 let mut index = 0 ;
191- let first = x . get ( 0 ) . unwrap ( ) ;
191+ let first = & x [ 0 ] ;
192192 // Get first elem, check against all other, break on mismatch
193193 ' outer: while index < first. len ( ) {
194194 for ident_match in x. iter ( ) . skip ( 1 ) {
195195 if let Some ( match_) = ident_match. get ( index) {
196- if match_ != first. get ( index) . unwrap ( ) {
196+ if match_ != & first[ index] {
197197 break ' outer;
198198 }
199199 } else {
@@ -205,7 +205,7 @@ impl Region {
205205 if index <= 1 {
206206 None
207207 } else {
208- if first. get ( index) . is_some ( ) && first. get ( index) . unwrap ( ) . chars ( ) . all ( |c| c. is_numeric ( ) ) {
208+ if first. get ( index) . is_some ( ) && first[ index] . chars ( ) . all ( |c| c. is_numeric ( ) ) {
209209 Some ( first. iter ( ) . take ( index) . cloned ( ) . collect ( ) )
210210 } else {
211211 Some ( first. iter ( ) . take ( index - 1 ) . cloned ( ) . collect ( ) )
@@ -231,7 +231,7 @@ impl Region {
231231 // This isn't a foolproof way of emitting the most
232232 // reasonable short description, but it's good enough.
233233 if f. description != result {
234- if result. len ( ) > 0 {
234+ if ! result. is_empty ( ) {
235235 result. push ( ' ' ) ;
236236 }
237237 result. push_str ( & f. description ) ;
@@ -553,8 +553,8 @@ fn expand(
553553
554554 for erc in ercs {
555555 ercs_expanded. extend ( match erc {
556- & Either :: Left ( ref register) => expand_register ( register, defs, name) ?,
557- & Either :: Right ( ref cluster) => expand_cluster ( cluster, defs) ?,
556+ Either :: Left ( ref register) => expand_register ( register, defs, name) ?,
557+ Either :: Right ( ref cluster) => expand_cluster ( cluster, defs) ?,
558558 } ) ;
559559 }
560560
@@ -806,9 +806,9 @@ fn expand_svd_register(register: &Register, name: Option<&str>) -> Vec<syn::Fiel
806806
807807 for ( idx, _i) in indices. iter ( ) . zip ( 0 ..) {
808808 let nb_name = if has_brackets {
809- info. name . replace ( "[%s]" , format ! ( "{}" , idx) . as_str ( ) )
809+ info. name . replace ( "[%s]" , idx)
810810 } else {
811- info. name . replace ( "%s" , format ! ( "{}" , idx) . as_str ( ) )
811+ info. name . replace ( "%s" , idx)
812812 } ;
813813
814814 let ty_name = if has_brackets {
@@ -930,9 +930,9 @@ fn expand_svd_cluster(cluster: &Cluster) -> Vec<syn::Field> {
930930
931931 for ( idx, _i) in indices. iter ( ) . zip ( 0 ..) {
932932 let name = if has_brackets {
933- info. name . replace ( "[%s]" , format ! ( "{}" , idx) . as_str ( ) )
933+ info. name . replace ( "[%s]" , idx)
934934 } else {
935- info. name . replace ( "%s" , format ! ( "{}" , idx) . as_str ( ) )
935+ info. name . replace ( "%s" , idx)
936936 } ;
937937
938938 let ty_name = if has_brackets {
0 commit comments