mirror of
https://github.com/actix/actix-extras.git
synced 2025-07-01 12:15:08 +02:00
clippy warnings
This commit is contained in:
@ -137,13 +137,13 @@ where
|
||||
let fut = Box::new(
|
||||
self.connector
|
||||
.call(connect)
|
||||
.map_err(|e| ClientError::from(e))
|
||||
.map_err(ClientError::from)
|
||||
.and_then(move |io| {
|
||||
// h1 protocol
|
||||
let framed = Framed::new(io, h1::ClientCodec::default());
|
||||
framed
|
||||
.send(request.into())
|
||||
.map_err(|e| ClientError::from(e))
|
||||
.map_err(ClientError::from)
|
||||
.and_then(|framed| {
|
||||
framed
|
||||
.into_future()
|
||||
|
@ -13,7 +13,9 @@ pub struct Parser;
|
||||
|
||||
impl Parser {
|
||||
fn parse_metadata(
|
||||
src: &[u8], server: bool, max_size: usize,
|
||||
src: &[u8],
|
||||
server: bool,
|
||||
max_size: usize,
|
||||
) -> Result<Option<(usize, bool, OpCode, usize, Option<u32>)>, ProtocolError> {
|
||||
let chunk_len = src.len();
|
||||
|
||||
@ -86,7 +88,9 @@ impl Parser {
|
||||
|
||||
/// Parse the input stream into a frame.
|
||||
pub fn parse(
|
||||
src: &mut BytesMut, server: bool, max_size: usize,
|
||||
src: &mut BytesMut,
|
||||
server: bool,
|
||||
max_size: usize,
|
||||
) -> Result<Option<(bool, OpCode, Option<BytesMut>)>, ProtocolError> {
|
||||
// try to parse ws frame metadata
|
||||
let (idx, finished, opcode, length, mask) =
|
||||
@ -148,7 +152,11 @@ impl Parser {
|
||||
|
||||
/// Generate binary representation
|
||||
pub fn write_message<B: Into<Binary>>(
|
||||
dst: &mut BytesMut, pl: B, op: OpCode, fin: bool, mask: bool,
|
||||
dst: &mut BytesMut,
|
||||
pl: B,
|
||||
op: OpCode,
|
||||
fin: bool,
|
||||
mask: bool,
|
||||
) {
|
||||
let payload = pl.into();
|
||||
let one: u8 = if fin {
|
||||
|
@ -1,5 +1,5 @@
|
||||
//! This is code from [Tungstenite project](https://github.com/snapview/tungstenite-rs)
|
||||
#![cfg_attr(feature = "cargo-clippy", allow(clippy::cast_ptr_alignment))]
|
||||
#![cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
|
||||
use std::ptr::copy_nonoverlapping;
|
||||
use std::slice;
|
||||
|
||||
@ -19,7 +19,7 @@ impl<'a> ShortSlice<'a> {
|
||||
|
||||
/// Faster version of `apply_mask()` which operates on 8-byte blocks.
|
||||
#[inline]
|
||||
#[cfg_attr(feature = "cargo-clippy", allow(clippy::cast_lossless))]
|
||||
#[cfg_attr(feature = "cargo-clippy", allow(cast_lossless))]
|
||||
pub(crate) fn apply_mask(buf: &mut [u8], mask_u32: u32) {
|
||||
// Extend the mask to 64 bits
|
||||
let mut mask_u64 = ((mask_u32 as u64) << 32) | (mask_u32 as u64);
|
||||
@ -50,10 +50,7 @@ pub(crate) fn apply_mask(buf: &mut [u8], mask_u32: u32) {
|
||||
// TODO: copy_nonoverlapping here compiles to call memcpy. While it is not so
|
||||
// inefficient, it could be done better. The compiler does not understand that
|
||||
// a `ShortSlice` must be smaller than a u64.
|
||||
#[cfg_attr(
|
||||
feature = "cargo-clippy",
|
||||
allow(clippy::needless_pass_by_value)
|
||||
)]
|
||||
#[cfg_attr(feature = "cargo-clippy", allow(needless_pass_by_value))]
|
||||
fn xor_short(buf: ShortSlice, mask: u64) {
|
||||
// Unsafe: we know that a `ShortSlice` fits in a u64
|
||||
unsafe {
|
||||
|
Reference in New Issue
Block a user