@@ -98,17 +98,16 @@ where
98
98
let media_range_from_url = MimeGuess :: from_path ( path) . first ( ) ;
99
99
let path_without_extension = if media_range_from_url. is_some ( ) {
100
100
// Drop the extension from the path.
101
- path. rsplitn ( 2 , '.' ) . last ( ) . expect (
102
- "You've encountered a bug! This should never happen: Calling rsplitn(2, ..) on \
103
- a non-empty string returned an empty iterator. This should be impossible!",
104
- )
101
+ path. rsplitn ( 2 , '.' ) . last ( ) . expect ( bug_message ! (
102
+ "Calling rsplitn(2, ..) on a non-empty string returned an empty iterator. This should be impossible!" ,
103
+ ) )
105
104
} else {
106
105
path
107
106
} ;
108
107
109
108
match path_without_extension. parse :: < Route > ( ) {
110
109
Err ( error) => panic ! (
111
- "You've encountered a bug! This should never happen: HTTP request path could not be parsed into a Route: {}",
110
+ bug_message! ( " This should never happen: HTTP request path could not be parsed into a Route: {}") ,
112
111
error,
113
112
) ,
114
113
Ok ( request_route) => {
@@ -266,9 +265,10 @@ where
266
265
{
267
266
let error_code = if !status_code. is_client_error ( ) && !status_code. is_server_error ( ) {
268
267
log:: error!(
269
- "You've encountered a bug! This should never happen: \
270
- The HTTP status code given to the error handler ({}) does not indicate an error.",
271
- status_code
268
+ bug_message!(
269
+ "This should never happen: The HTTP status code given to the error handler ({}) does not indicate an error." ,
270
+ ) ,
271
+ status_code,
272
272
) ;
273
273
http:: StatusCode :: INTERNAL_SERVER_ERROR
274
274
} else {
0 commit comments