From 23db2d0bfb602409998710cb6523e5929a3aa455 Mon Sep 17 00:00:00 2001 From: Manel Montilla Date: Mon, 18 Dec 2023 21:54:55 +0100 Subject: [PATCH] all: fix some style issues --- wruster/src/http/headers.rs | 2 +- wruster/src/streams/mod.rs | 2 +- wruster/src/streams/test_utils.rs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/wruster/src/http/headers.rs b/wruster/src/http/headers.rs index e88a501..91086de 100644 --- a/wruster/src/http/headers.rs +++ b/wruster/src/http/headers.rs @@ -107,7 +107,7 @@ impl Headers { pub fn add(&mut self, header: Header) { let name = header.name; let content = header.value; - let values = self.headers.entry(name).or_insert_with(Vec::new); + let values = self.headers.entry(name).or_default(); values.push(content); } diff --git a/wruster/src/streams/mod.rs b/wruster/src/streams/mod.rs index ce6dcb0..04a281d 100644 --- a/wruster/src/streams/mod.rs +++ b/wruster/src/streams/mod.rs @@ -1,5 +1,5 @@ /*! -Contains various types that augment a type that can act as a [Stream], e.g.: a [std::net::TcpStream]. +Contains various types that augment a [Stream], e.g.: a [std::net::TcpStream]. */ use std::io::Read; use std::io::{self, Write}; diff --git a/wruster/src/streams/test_utils.rs b/wruster/src/streams/test_utils.rs index 95cec7e..c7bb84f 100644 --- a/wruster/src/streams/test_utils.rs +++ b/wruster/src/streams/test_utils.rs @@ -13,7 +13,7 @@ pub struct TcpClient { impl TcpClient { #[allow(dead_code)] pub fn connect(addr: String) -> Result> { - let stream = TcpStream::connect(&addr)?; + let stream = TcpStream::connect(addr)?; let stream = Some(stream); Ok(TcpClient { stream }) } @@ -66,7 +66,7 @@ pub fn load_test_file(name: &str) -> Result { file_path.push("tests/assets"); file_path.push(name); let file = fs::File::open(&file_path).unwrap(); - return Ok(file); + Ok(file) } #[allow(dead_code)]