@@ -7,8 +7,8 @@ use super::*;
7
7
use crate :: bug_message;
8
8
use handlebars:: { self , Handlebars } ;
9
9
use mime_guess:: MimeGuess ;
10
- use std:: collections:: hash_map:: Entry ;
11
10
use std:: collections:: HashMap ;
11
+ use std:: collections:: hash_map:: Entry ;
12
12
use std:: path:: Path ;
13
13
use std:: sync:: { Arc , RwLock } ;
14
14
use thiserror:: Error ;
@@ -149,13 +149,13 @@ where
149
149
return Err ( ContentLoadingError :: ContentFileNameError ( format ! (
150
150
"Content file name '{}' has too many extensions." ,
151
151
entry. relative_path
152
- ) ) )
152
+ ) ) ) ;
153
153
}
154
154
[ ] => {
155
155
return Err ( ContentLoadingError :: ContentFileNameError ( format ! (
156
156
"Content file names must have extensions, but '{}' does not." ,
157
157
entry. relative_path
158
- ) ) )
158
+ ) ) ) ;
159
159
}
160
160
}
161
161
}
@@ -222,14 +222,12 @@ where
222
222
// have the executable bit set. They are evaluated when rendered.
223
223
[ first_extension, Self :: HANDLEBARS_FILE_EXTENSION ] => {
224
224
if content. is_executable {
225
- return Err ( ContentLoadingError :: ContentFileNameError (
226
- format ! (
227
- "The content file '{}' appears to be a handlebars file (because it ends in '.{}'), \
225
+ return Err ( ContentLoadingError :: ContentFileNameError ( format ! (
226
+ "The content file '{}' appears to be a handlebars file (because it ends in '.{}'), \
228
227
but it is also executable. It must be one or the other.",
229
- content. relative_path,
230
- Self :: HANDLEBARS_FILE_EXTENSION ,
231
- ) ,
232
- ) ) ;
228
+ content. relative_path,
229
+ Self :: HANDLEBARS_FILE_EXTENSION ,
230
+ ) ) ) ;
233
231
}
234
232
235
233
let mime = MimeGuess :: from_ext ( first_extension)
@@ -480,12 +478,9 @@ mod tests {
480
478
let actual_output = media_to_string ( rendered) ;
481
479
482
480
assert_eq ! (
483
- actual_output,
484
- expected_output,
481
+ actual_output, expected_output,
485
482
"Template rendering for `{}` did not produce the expected output (\" {}\" ), instead got \" {}\" " ,
486
- template,
487
- expected_output,
488
- actual_output,
483
+ template, expected_output, actual_output,
489
484
) ;
490
485
}
491
486
}
@@ -539,12 +534,9 @@ mod tests {
539
534
let actual_output = media_to_string ( rendered) ;
540
535
541
536
assert_eq ! (
542
- actual_output,
543
- expected_output,
537
+ actual_output, expected_output,
544
538
"Template rendering for `{}` did not produce the expected output (\" {}\" ), instead got \" {}\" " ,
545
- template,
546
- expected_output,
547
- actual_output,
539
+ template, expected_output, actual_output,
548
540
) ;
549
541
}
550
542
@@ -573,12 +565,9 @@ mod tests {
573
565
let actual_output = media_to_string ( rendered) ;
574
566
575
567
assert_eq ! (
576
- actual_output,
577
- expected_output,
568
+ actual_output, expected_output,
578
569
"Rendering content at '{}' did not produce the expected output (\" {}\" ), instead got \" {}\" " ,
579
- route,
580
- expected_output,
581
- actual_output,
570
+ route, expected_output, actual_output,
582
571
) ;
583
572
}
584
573
@@ -639,12 +628,9 @@ mod tests {
639
628
let actual_output = media_to_string ( rendered) ;
640
629
641
630
assert_eq ! (
642
- actual_output,
643
- expected_output,
631
+ actual_output, expected_output,
644
632
"Template rendering for `{}` did not produce the expected output (\" {}\" ), instead got \" {}\" " ,
645
- template,
646
- expected_output,
647
- actual_output,
633
+ template, expected_output, actual_output,
648
634
) ;
649
635
}
650
636
@@ -709,12 +695,9 @@ mod tests {
709
695
let actual_output = media_to_string ( rendered) ;
710
696
711
697
assert_eq ! (
712
- actual_output,
713
- expected_output,
698
+ actual_output, expected_output,
714
699
"Template rendering for `{}` did not produce the expected output (\" {}\" ), instead got \" {}\" " ,
715
- template,
716
- expected_output,
717
- actual_output,
700
+ template, expected_output, actual_output,
718
701
) ;
719
702
}
720
703
@@ -750,12 +733,9 @@ mod tests {
750
733
let actual_output = media_to_string ( rendered) ;
751
734
752
735
assert_eq ! (
753
- actual_output,
754
- expected_output,
736
+ actual_output, expected_output,
755
737
"Template rendering for `{}` did not produce the expected output (\" {}\" ), instead got \" {}\" " ,
756
- template,
757
- expected_output,
758
- actual_output,
738
+ template, expected_output, actual_output,
759
739
) ;
760
740
}
761
741
@@ -949,12 +929,9 @@ mod tests {
949
929
let actual_output = media_to_string ( rendered) ;
950
930
951
931
assert_eq ! (
952
- actual_output,
953
- expected_output,
932
+ actual_output, expected_output,
954
933
"Rendering content at '{}' did not produce the expected output (\" {}\" ), instead got \" {}\" " ,
955
- route,
956
- expected_output,
957
- actual_output,
934
+ route, expected_output, actual_output,
958
935
) ;
959
936
}
960
937
@@ -980,12 +957,9 @@ mod tests {
980
957
let actual_output = media_to_string ( rendered) ;
981
958
982
959
assert_eq ! (
983
- actual_output,
984
- expected_output1,
960
+ actual_output, expected_output1,
985
961
"Rendering content at '{}' did not produce the expected output (\" {}\" ), instead got \" {}\" " ,
986
- route1,
987
- expected_output1,
988
- actual_output,
962
+ route1, expected_output1, actual_output,
989
963
) ;
990
964
991
965
let route2 = route ( "/subdirectory/pwd" ) ;
@@ -1003,12 +977,9 @@ mod tests {
1003
977
let actual_output = media_to_string ( rendered) ;
1004
978
1005
979
assert_eq ! (
1006
- actual_output,
1007
- expected_output2,
980
+ actual_output, expected_output2,
1008
981
"Rendering content at '{}' did not produce the expected output (\" {}\" ), instead got \" {}\" " ,
1009
- route2,
1010
- expected_output2,
1011
- actual_output,
982
+ route2, expected_output2, actual_output,
1012
983
) ;
1013
984
}
1014
985
@@ -1099,12 +1070,9 @@ mod tests {
1099
1070
let actual_output = media_to_string ( rendered) ;
1100
1071
1101
1072
assert_eq ! (
1102
- actual_output,
1103
- expected_output,
1073
+ actual_output, expected_output,
1104
1074
"Rendering content at '{}' did not produce the expected output (\" {}\" ), instead got \" {}\" " ,
1105
- route,
1106
- expected_output,
1107
- actual_output,
1075
+ route, expected_output, actual_output,
1108
1076
) ;
1109
1077
}
1110
1078
0 commit comments