Skip to content

Commit

Permalink
minor lints and cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
nyurik committed Nov 12, 2024
1 parent e2d4b14 commit 5791379
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 16 deletions.
4 changes: 1 addition & 3 deletions src/async_impl/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2847,10 +2847,8 @@ fn add_cookie_header(headers: &mut HeaderMap, cookie_store: &dyn cookie::CookieS
}
}

#[cfg(test)]
#[cfg(all(test, not(feature = "rustls-tls-manual-roots-no-provider")))]
mod tests {
#![cfg(not(feature = "rustls-tls-manual-roots-no-provider"))]

#[tokio::test]
async fn execute_request_rejects_invalid_urls() {
let url_str = "hxxps://www.rust-lang.org/";
Expand Down
6 changes: 1 addition & 5 deletions src/async_impl/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ use std::future::Future;
use std::time::Duration;

use serde::Serialize;
#[cfg(feature = "json")]
use serde_json;

use super::body::Body;
use super::client::{Client, Pending};
Expand Down Expand Up @@ -650,10 +648,8 @@ impl TryFrom<Request> for HttpRequest<Body> {
}
}

#[cfg(test)]
#[cfg(all(test, not(feature = "rustls-tls-manual-roots-no-provider")))]
mod tests {
#![cfg(not(feature = "rustls-tls-manual-roots-no-provider"))]

use super::{Client, HttpRequest, Request, RequestBuilder, Version};
use crate::Method;
use serde::Serialize;
Expand Down
2 changes: 0 additions & 2 deletions src/async_impl/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ use hyper::{HeaderMap, StatusCode, Version};
use hyper_util::client::legacy::connect::HttpInfo;
#[cfg(feature = "json")]
use serde::de::DeserializeOwned;
#[cfg(feature = "json")]
use serde_json;
use tokio::time::Sleep;
use url::Url;

Expand Down
7 changes: 2 additions & 5 deletions src/blocking/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,10 +346,7 @@ impl Response {
/// # Ok(())
/// # }
/// ```
pub fn copy_to<W: ?Sized>(&mut self, w: &mut W) -> crate::Result<u64>
where
W: io::Write,
{
pub fn copy_to<W: io::Write + ?Sized>(&mut self, w: &mut W) -> crate::Result<u64> {
io::copy(self, w).map_err(crate::error::decode_io)
}

Expand Down Expand Up @@ -401,7 +398,7 @@ impl Response {
/// # fn main() {}
/// ```
pub fn error_for_status_ref(&self) -> crate::Result<&Self> {
self.inner.error_for_status_ref().and_then(|_| Ok(self))
self.inner.error_for_status_ref().map(|_| self)
}

// private
Expand Down
1 change: 0 additions & 1 deletion tests/deflate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ async fn deflate_case(response_size: usize, chunk_size: usize) {
use futures_util::stream::StreamExt;

let content: String = (0..response_size)
.into_iter()
.map(|i| format!("test {i}"))
.collect();
let mut encoder = libflate::zlib::Encoder::new(Vec::new()).unwrap();
Expand Down

0 comments on commit 5791379

Please sign in to comment.