From e4d292ae58d3818c9d8d0a151bd337fa091c8c38 Mon Sep 17 00:00:00 2001 From: p11 Date: Thu, 19 Sep 2024 14:23:23 +0200 Subject: [PATCH] Use Self type where possible --- src/main.rs | 2 +- src/request.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index 1a05e1e..468a83e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -142,7 +142,7 @@ impl FromStream for SiteInfo { let up = S::size_from_stream(stream)?; let down = S::size_from_stream(stream)?; - Ok(SiteInfo { + Ok(Self { comments, visits, up, diff --git a/src/request.rs b/src/request.rs index a3f6ca7..a305fb7 100644 --- a/src/request.rs +++ b/src/request.rs @@ -10,7 +10,7 @@ pub struct Request { } impl Request { - pub fn from(mut stream: &TcpStream) -> Option { + pub fn from(mut stream: &TcpStream) -> Option { let mut buffer = [0; 16384]; let _ = stream.read(&mut buffer).ok()?; @@ -49,7 +49,7 @@ impl Request { request_lines.next(); let headers: Vec = request_lines.map(|header| header.to_string()).collect(); - Some(Request { + Some(Self { method, path, version,