File tree 1 file changed +11
-12
lines changed
1 file changed +11
-12
lines changed Original file line number Diff line number Diff line change @@ -146,18 +146,17 @@ pub fn read_file_from_fs(file_path: &Path) -> io::Result<EmbeddedFile> {
146
146
} ;
147
147
148
148
let metadata = fs:: metadata ( file_path) ?;
149
- let last_modified = metadata. modified ( ) . ok ( ) . map ( |last_modified| {
150
- last_modified
151
- . duration_since ( SystemTime :: UNIX_EPOCH )
152
- . expect ( "Time before the UNIX epoch is unsupported" )
153
- . as_secs ( )
154
- } ) ;
155
- let created = metadata. created ( ) . ok ( ) . map ( |created| {
156
- created
157
- . duration_since ( SystemTime :: UNIX_EPOCH )
158
- . expect ( "Time before the UNIX epoch is unsupported" )
159
- . as_secs ( )
160
- } ) ;
149
+ let last_modified = metadata
150
+ . modified ( )
151
+ . ok ( )
152
+ . and_then ( |modified| modified. duration_since ( SystemTime :: UNIX_EPOCH ) . ok ( ) )
153
+ . map ( |secs| secs. as_secs ( ) ) ;
154
+
155
+ let created = metadata
156
+ . created ( )
157
+ . ok ( )
158
+ . and_then ( |created| created. duration_since ( SystemTime :: UNIX_EPOCH ) . ok ( ) )
159
+ . map ( |secs| secs. as_secs ( ) ) ;
161
160
162
161
#[ cfg( feature = "mime-guess" ) ]
163
162
let mimetype = mime_guess:: from_path ( file_path) . first_or_octet_stream ( ) . to_string ( ) ;
You can’t perform that action at this time.
0 commit comments