Use Self type where possible

This commit is contained in:
p11 2024-09-19 14:23:23 +02:00
parent c4b0f31dbf
commit e4d292ae58
2 changed files with 3 additions and 3 deletions

View File

@ -142,7 +142,7 @@ impl<S: SizeSettings> FromStream<S> for SiteInfo {
let up = S::size_from_stream(stream)?; let up = S::size_from_stream(stream)?;
let down = S::size_from_stream(stream)?; let down = S::size_from_stream(stream)?;
Ok(SiteInfo { Ok(Self {
comments, comments,
visits, visits,
up, up,

View File

@ -10,7 +10,7 @@ pub struct Request {
} }
impl Request { impl Request {
pub fn from(mut stream: &TcpStream) -> Option<Request> { pub fn from(mut stream: &TcpStream) -> Option<Self> {
let mut buffer = [0; 16384]; let mut buffer = [0; 16384];
let _ = stream.read(&mut buffer).ok()?; let _ = stream.read(&mut buffer).ok()?;
@ -49,7 +49,7 @@ impl Request {
request_lines.next(); request_lines.next();
let headers: Vec<String> = request_lines.map(|header| header.to_string()).collect(); let headers: Vec<String> = request_lines.map(|header| header.to_string()).collect();
Some(Request { Some(Self {
method, method,
path, path,
version, version,