File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -130,7 +130,6 @@ impl AsRef<String> for NonEmptyString {
130
130
}
131
131
}
132
132
133
-
134
133
impl < ' s > TryFrom < & ' s str > for NonEmptyString {
135
134
type Error = & ' s str ;
136
135
@@ -158,10 +157,10 @@ impl Display for NonEmptyString {
158
157
}
159
158
160
159
impl FromStr for NonEmptyString {
161
- type Err = EmptyString ;
160
+ type Err = EmptyString ;
162
161
163
162
fn from_str ( s : & str ) -> Result < Self , Self :: Err > {
164
- if s. is_empty ( ) {
163
+ if s. is_empty ( ) {
165
164
return Err ( EmptyString ) ;
166
165
}
167
166
@@ -226,11 +225,11 @@ mod tests {
226
225
let empty_str = "" ;
227
226
let valid_str = "string" ;
228
227
229
- let _non_empty_string = NonEmptyString :: from_str ( empty_str )
230
- . expect_err ( "operation must be failed" ) ;
228
+ let _non_empty_string =
229
+ NonEmptyString :: from_str ( empty_str ) . expect_err ( "operation must be failed" ) ;
231
230
232
231
let non_empty_string = NonEmptyString :: from_str ( valid_str) . unwrap ( ) ;
233
232
assert_eq ! ( non_empty_string. as_str( ) , valid_str) ;
233
+ assert_eq ! ( non_empty_string, valid_str. parse( ) . unwrap( ) ) ;
234
234
}
235
-
236
235
}
You can’t perform that action at this time.
0 commit comments