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 {
130130 }
131131}
132132
133-
134133impl < ' s > TryFrom < & ' s str > for NonEmptyString {
135134 type Error = & ' s str ;
136135
@@ -158,10 +157,10 @@ impl Display for NonEmptyString {
158157}
159158
160159impl FromStr for NonEmptyString {
161- type Err = EmptyString ;
160+ type Err = EmptyString ;
162161
163162 fn from_str ( s : & str ) -> Result < Self , Self :: Err > {
164- if s. is_empty ( ) {
163+ if s. is_empty ( ) {
165164 return Err ( EmptyString ) ;
166165 }
167166
@@ -226,11 +225,11 @@ mod tests {
226225 let empty_str = "" ;
227226 let valid_str = "string" ;
228227
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" ) ;
231230
232231 let non_empty_string = NonEmptyString :: from_str ( valid_str) . unwrap ( ) ;
233232 assert_eq ! ( non_empty_string. as_str( ) , valid_str) ;
233+ assert_eq ! ( non_empty_string, valid_str. parse( ) . unwrap( ) ) ;
234234 }
235-
236235}
You can’t perform that action at this time.
0 commit comments