File tree Expand file tree Collapse file tree 3 files changed +7
-10
lines changed Expand file tree Collapse file tree 3 files changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ pub fn execute(args: &ArgMatches) -> Result<()> {
83
83
. config
84
84
. get ( "output.html.input-404" )
85
85
. map ( toml:: Value :: as_str)
86
- . flatten ( )
86
+ . and_then ( std :: convert :: identity ) // flatten
87
87
. map ( ToString :: to_string) ;
88
88
let file_404 = get_404_output_file ( & input_404) ;
89
89
Original file line number Diff line number Diff line change @@ -1022,10 +1022,7 @@ mod tests {
1022
1022
let got = Config :: from_str ( src) . unwrap ( ) ;
1023
1023
let html_config = got. html_config ( ) . unwrap ( ) ;
1024
1024
assert_eq ! ( html_config. input_404, None ) ;
1025
- assert_eq ! (
1026
- & get_404_output_file( & html_config. input_404) ,
1027
- "404.html"
1028
- ) ;
1025
+ assert_eq ! ( & get_404_output_file( & html_config. input_404) , "404.html" ) ;
1029
1026
}
1030
1027
1031
1028
#[ test]
@@ -1039,9 +1036,6 @@ mod tests {
1039
1036
let got = Config :: from_str ( src) . unwrap ( ) ;
1040
1037
let html_config = got. html_config ( ) . unwrap ( ) ;
1041
1038
assert_eq ! ( html_config. input_404, Some ( "missing.md" . to_string( ) ) ) ;
1042
- assert_eq ! (
1043
- & get_404_output_file( & html_config. input_404) ,
1044
- "missing.html"
1045
- ) ;
1039
+ assert_eq ! ( & get_404_output_file( & html_config. input_404) , "missing.html" ) ;
1046
1040
}
1047
1041
}
Original file line number Diff line number Diff line change @@ -178,7 +178,10 @@ pub fn copy_files_except_ext(
178
178
}
179
179
180
180
pub fn get_404_output_file ( input_404 : & Option < String > ) -> String {
181
- input_404. as_ref ( ) . unwrap_or ( & "404.md" . to_string ( ) ) . replace ( ".md" , ".html" )
181
+ input_404
182
+ . as_ref ( )
183
+ . unwrap_or ( & "404.md" . to_string ( ) )
184
+ . replace ( ".md" , ".html" )
182
185
}
183
186
184
187
#[ cfg( test) ]
You can’t perform that action at this time.
0 commit comments