Skip to content

Commit 61681e7

Browse files
committed
feedback from review
1 parent 01afa23 commit 61681e7

File tree

5 files changed

+18
-18
lines changed

5 files changed

+18
-18
lines changed

src/auth/authentication_scheme.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::fmt::{self, Display};
22
use std::str::FromStr;
33

4-
use crate::bail2 as bail;
4+
use crate::bail_status as bail;
55

66
/// HTTP Mutual Authentication Algorithms
77
#[derive(Debug, PartialEq, Eq, Clone, Copy)]

src/auth/authorization.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::auth::AuthenticationScheme;
2-
use crate::bail2 as bail;
2+
use crate::bail_status as bail;
33
use crate::headers::{HeaderName, HeaderValue, Headers, AUTHORIZATION};
44

55
/// Credentials to authenticate a user agent with a server.

src/auth/basic_auth.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::auth::{AuthenticationScheme, Authorization};
22
use crate::headers::{HeaderName, HeaderValue, Headers, AUTHORIZATION};
33
use crate::Status;
4-
use crate::{bail2 as bail, ensure2 as ensure};
4+
use crate::{bail_status as bail, ensure_status as ensure};
55

66
/// HTTP Basic authorization.
77
///
@@ -73,7 +73,7 @@ impl BasicAuth {
7373

7474
let (username, password) = match (username, password) {
7575
(Some(username), Some(password)) => (username.to_string(), password.to_string()),
76-
(Some(_), None) => bail!(400, "Expected basic auth to a password"),
76+
(Some(_), None) => bail!(400, "Expected basic auth to contain a password"),
7777
(None, _) => bail!(400, "Expected basic auth to contain a username"),
7878
};
7979

src/auth/www_authenticate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::auth::AuthenticationScheme;
2-
use crate::bail2 as bail;
2+
use crate::bail_status as bail;
33
use crate::headers::{HeaderName, HeaderValue, Headers, WWW_AUTHENTICATE};
44

55
/// Define the authentication method that should be used to gain access to a

src/macros.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,15 @@ macro_rules! format_err {
8888
/// Return early with an error and a status code.
8989
#[doc(hidden)]
9090
#[macro_export]
91-
macro_rules! bail2 {
91+
macro_rules! bail_status {
9292
($status:literal, $msg:literal $(,)?) => {{
93-
return $crate::private::Err($crate::format_err2!($status, $msg));
93+
return $crate::private::Err($crate::format_err_status!($status, $msg));
9494
}};
9595
($status:literal, $msg:expr $(,)?) => {
96-
return $crate::private::Err($crate::format_err2!($status, $msg));
96+
return $crate::private::Err($crate::format_err_status!($status, $msg));
9797
};
9898
($status:literal, $msg:expr, $($arg:tt)*) => {
99-
return $crate::private::Err($crate::format_err2!($status, $msg, $($arg)*));
99+
return $crate::private::Err($crate::format_err_status!($status, $msg, $($arg)*));
100100
};
101101
}
102102

@@ -109,20 +109,20 @@ macro_rules! bail2 {
109109
/// rather than panicking.
110110
#[doc(hidden)]
111111
#[macro_export]
112-
macro_rules! ensure2 {
112+
macro_rules! ensure_status {
113113
($cond:expr, $status:literal, $msg:literal $(,)?) => {
114114
if !$cond {
115-
return $crate::private::Err($crate::format_err2!($status, $msg));
115+
return $crate::private::Err($crate::format_err_status!($status, $msg));
116116
}
117117
};
118118
($cond:expr, $status:literal, $msg:expr $(,)?) => {
119119
if !$cond {
120-
return $crate::private::Err($crate::format_err2!($status, $msg));
120+
return $crate::private::Err($crate::format_err_status!($status, $msg));
121121
}
122122
};
123123
($cond:expr, $status:literal, $msg:expr, $($arg:tt)*) => {
124124
if !$cond {
125-
return $crate::private::Err($crate::format_err2!($status, $msg, $($arg)*));
125+
return $crate::private::Err($crate::format_err_status!($status, $msg, $($arg)*));
126126
}
127127
};
128128
}
@@ -136,20 +136,20 @@ macro_rules! ensure2 {
136136
/// rather than panicking.
137137
#[doc(hidden)]
138138
#[macro_export]
139-
macro_rules! ensure_eq2 {
139+
macro_rules! ensure_eq_status {
140140
($left:expr, $right:expr, $status:literal, $msg:literal $(,)?) => {
141141
if $left != $right {
142-
return $crate::private::Err($crate::format_err2!($status, $msg));
142+
return $crate::private::Err($crate::format_err_status!($status, $msg));
143143
}
144144
};
145145
($left:expr, $right:expr, $status:literal, $msg:expr $(,)?) => {
146146
if $left != $right {
147-
return $crate::private::Err($crate::format_err2!($status, $msg));
147+
return $crate::private::Err($crate::format_err_status!($status, $msg));
148148
}
149149
};
150150
($left:expr, $right:expr, $status:literal, $msg:expr, $($arg:tt)*) => {
151151
if $left != $right {
152-
return $crate::private::Err($crate::format_err2!($status, $msg, $($arg)*));
152+
return $crate::private::Err($crate::format_err_status!($status, $msg, $($arg)*));
153153
}
154154
};
155155
}
@@ -161,7 +161,7 @@ macro_rules! ensure_eq2 {
161161
/// `Debug` and `Display`.
162162
#[doc(hidden)]
163163
#[macro_export]
164-
macro_rules! format_err2 {
164+
macro_rules! format_err_status {
165165
($status:literal, $msg:literal $(,)?) => {{
166166
// Handle $:literal as a special case to make cargo-expanded code more
167167
// concise in the common case.

0 commit comments

Comments
 (0)