@@ -5,7 +5,7 @@ use pomsky_macro::pomsky;
5
5
use serde:: { Deserialize , Serialize } ;
6
6
use std:: { cmp:: Ordering , fmt} ;
7
7
8
- static VALIDATION_REGEX : & ' static str = pomsky ! (
8
+ static VALIDATION_REGEX : & str = pomsky ! (
9
9
"v" ?
10
10
11
11
( : epoch( [ '0' -'9' ] +) '!' ) ?
@@ -90,7 +90,7 @@ impl PartialOrd for PostHeader {
90
90
}
91
91
92
92
if self . post_num < other. post_num {
93
- return Some ( Ordering :: Less ) ;
93
+ Some ( Ordering :: Less )
94
94
} else {
95
95
Some ( Ordering :: Greater )
96
96
}
@@ -123,7 +123,7 @@ pub struct ReleaseHeader {
123
123
/// corretly interpets priority
124
124
///
125
125
/// Lower == More important
126
- ///
126
+ ///
127
127
/// # Example Usage
128
128
/// ```
129
129
/// let _ = PackageVersion::new("v1.0");
@@ -186,8 +186,8 @@ impl PackageVersion {
186
186
187
187
let release: ReleaseHeader = match version_match. name ( "release" ) {
188
188
Some ( v) => {
189
- if v. as_str ( ) . contains ( "." ) {
190
- let split: Vec < & str > = v. as_str ( ) . split ( "." ) . into_iter ( ) . collect ( ) ;
189
+ if v. as_str ( ) . contains ( '.' ) {
190
+ let split: Vec < & str > = v. as_str ( ) . split ( '.' ) . into_iter ( ) . collect ( ) ;
191
191
ReleaseHeader {
192
192
major : split[ 0 ] . parse :: < u32 > ( ) ?,
193
193
minor : split[ 1 ] . parse :: < u32 > ( ) ?,
@@ -268,10 +268,8 @@ impl PackageVersion {
268
268
None => None ,
269
269
} ;
270
270
271
- let local: Option < String > = match version_match. name ( "local" ) {
272
- Some ( v) => Some ( v. as_str ( ) . to_string ( ) ) ,
273
- None => None ,
274
- } ;
271
+ let local: Option < String > =
272
+ version_match. name ( "local" ) . map ( |v| v. as_str ( ) . to_string ( ) ) ;
275
273
276
274
Ok ( Self {
277
275
original : version. to_string ( ) ,
0 commit comments