http: clippy fixes

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2021-12-07 11:45:52 +01:00
parent 59986f1195
commit 179515c5b2
2 changed files with 3 additions and 4 deletions

View File

@ -83,8 +83,8 @@ impl SimpleHttp {
}
pub async fn request(&self, mut request: Request<Body>) -> Result<Response<Body>, Error> {
let user_agent = if let Some(ref user_agent) = self.options.user_agent {
HeaderValue::from_str(&user_agent)?
let user_agent = if let Some(user_agent) = &self.options.user_agent {
HeaderValue::from_str(user_agent)?
} else {
HeaderValue::from_str(Self::DEFAULT_USER_AGENT_STRING)?
};

View File

@ -609,13 +609,12 @@ impl<R: AsyncRead + Unpin + Send + 'static> AsyncRead for WebSocketReader<R> {
ReaderState::HaveData
};
this.read_buffer = Some(read_buffer);
continue;
} else {
this.header = Some(header);
this.read_buffer = Some(read_buffer);
this.state = ReaderState::NoData;
continue;
}
continue;
}
let len = min(buf.remaining(), min(header.payload_len, read_buffer.len()));