mirror of
https://github.com/rwf2/Rocket.git
synced 2025-02-08 01:32:02 +00:00
Use 'matches!' macro where possible.
This commit is contained in:
parent
928d51ca6e
commit
f82d760b52
@ -167,13 +167,11 @@ impl<L: Listener> Accept for Incoming<L> {
|
|||||||
/// The delay is useful to handle resource exhaustion errors like ENFILE
|
/// The delay is useful to handle resource exhaustion errors like ENFILE
|
||||||
/// and EMFILE. Otherwise, could enter into tight loop.
|
/// and EMFILE. Otherwise, could enter into tight loop.
|
||||||
fn is_connection_error(e: &io::Error) -> bool {
|
fn is_connection_error(e: &io::Error) -> bool {
|
||||||
match e.kind() {
|
matches!(e.kind(),
|
||||||
io::ErrorKind::ConnectionRefused |
|
io::ErrorKind::ConnectionRefused |
|
||||||
io::ErrorKind::ConnectionAborted |
|
io::ErrorKind::ConnectionAborted |
|
||||||
io::ErrorKind::ConnectionReset => true,
|
io::ErrorKind::ConnectionReset)
|
||||||
_ => false,
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
impl<L: fmt::Debug> fmt::Debug for Incoming<L> {
|
impl<L: fmt::Debug> fmt::Debug for Incoming<L> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
@ -5,9 +5,6 @@ pub fn is_whitespace(&byte: &char) -> bool {
|
|||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn is_valid_token(&c: &char) -> bool {
|
pub fn is_valid_token(&c: &char) -> bool {
|
||||||
match c {
|
matches!(c, '0'..='9' | 'A'..='Z' | '^'..='~' | '#'..='\''
|
||||||
'0'..='9' | 'A'..='Z' | '^'..='~' | '#'..='\''
|
| '!' | '*' | '+' | '-' | '.')
|
||||||
| '!' | '*' | '+' | '-' | '.' => true,
|
|
||||||
_ => false
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user