mirror of
https://github.com/fafhrd91/actix-web
synced 2025-06-25 06:39:22 +02:00
address clippy lints
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
use std::convert::{From, Into};
|
||||
use std::fmt;
|
||||
|
||||
use self::OpCode::*;
|
||||
/// Operation codes as part of RFC6455.
|
||||
#[derive(Debug, Eq, PartialEq, Clone, Copy)]
|
||||
pub enum OpCode {
|
||||
@ -29,6 +28,7 @@ pub enum OpCode {
|
||||
|
||||
impl fmt::Display for OpCode {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
use self::OpCode::*;
|
||||
match *self {
|
||||
Continue => write!(f, "CONTINUE"),
|
||||
Text => write!(f, "TEXT"),
|
||||
@ -41,9 +41,10 @@ impl fmt::Display for OpCode {
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<u8> for OpCode {
|
||||
fn into(self) -> u8 {
|
||||
match self {
|
||||
impl From<OpCode> for u8 {
|
||||
fn from(op: OpCode) -> u8 {
|
||||
use self::OpCode::*;
|
||||
match op {
|
||||
Continue => 0,
|
||||
Text => 1,
|
||||
Binary => 2,
|
||||
@ -60,6 +61,7 @@ impl Into<u8> for OpCode {
|
||||
|
||||
impl From<u8> for OpCode {
|
||||
fn from(byte: u8) -> OpCode {
|
||||
use self::OpCode::*;
|
||||
match byte {
|
||||
0 => Continue,
|
||||
1 => Text,
|
||||
@ -72,7 +74,6 @@ impl From<u8> for OpCode {
|
||||
}
|
||||
}
|
||||
|
||||
use self::CloseCode::*;
|
||||
/// Status code used to indicate why an endpoint is closing the `WebSocket`
|
||||
/// connection.
|
||||
#[derive(Debug, Eq, PartialEq, Clone, Copy)]
|
||||
@ -138,9 +139,10 @@ pub enum CloseCode {
|
||||
Other(u16),
|
||||
}
|
||||
|
||||
impl Into<u16> for CloseCode {
|
||||
fn into(self) -> u16 {
|
||||
match self {
|
||||
impl From<CloseCode> for u16 {
|
||||
fn from(code: CloseCode) -> u16 {
|
||||
use self::CloseCode::*;
|
||||
match code {
|
||||
Normal => 1000,
|
||||
Away => 1001,
|
||||
Protocol => 1002,
|
||||
@ -161,6 +163,7 @@ impl Into<u16> for CloseCode {
|
||||
|
||||
impl From<u16> for CloseCode {
|
||||
fn from(code: u16) -> CloseCode {
|
||||
use self::CloseCode::*;
|
||||
match code {
|
||||
1000 => Normal,
|
||||
1001 => Away,
|
||||
@ -185,6 +188,7 @@ impl From<u16> for CloseCode {
|
||||
pub struct CloseReason {
|
||||
/// Exit code
|
||||
pub code: CloseCode,
|
||||
|
||||
/// Optional description of the exit code
|
||||
pub description: Option<String>,
|
||||
}
|
||||
|
Reference in New Issue
Block a user