Skip to content

Commit bd70838

Browse files
committed
Remove use types that have been imported by default
1 parent c2d9127 commit bd70838

File tree

30 files changed

+11
-45
lines changed

30 files changed

+11
-45
lines changed

crates/cache/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
use std::borrow::Borrow;
1919
use std::collections::VecDeque;
2020
use std::error::Error as StdError;
21-
use std::future::Future;
2221
use std::hash::Hash;
2322

2423
use bytes::Bytes;

crates/compression/src/stream.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//! Compress the body of a response.
22
use std::collections::VecDeque;
3-
use std::future::Future;
43
use std::io::{self, Error as IoError, ErrorKind, Result as IoResult};
54
use std::pin::Pin;
65
use std::task::{Context, Poll, ready};

crates/core/src/conn/acme/cache.rs

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
77

88
use std::error::Error as StdError;
9-
use std::future::Future;
109
use std::io::{Error as IoError, ErrorKind, Result as IoResult};
1110
use std::path::Path;
1211

crates/core/src/conn/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
//! The module also provides support for HTTP versions 1 and 2, as well as the QUIC protocol.
55
//! Additionally, it includes implementations for Unix domain sockets.
66
use std::fmt::{self, Display, Formatter};
7-
use std::future::Future;
87
use std::io::Result as IoResult;
98

109
use http::uri::Scheme;

crates/core/src/conn/proto.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use std::cmp;
22
use std::error::Error as StdError;
3-
use std::future::Future;
43
use std::io::{Error as IoError, ErrorKind, IoSlice, Result as IoResult};
54
use std::marker::PhantomPinned;
65
use std::pin::Pin;

crates/core/src/conn/quinn/client.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//! Client implementation of the HTTP/3 protocol
22
33
use std::{
4-
convert::TryFrom,
54
marker::PhantomData,
65
sync::{atomic::AtomicUsize, Arc},
76
task::{Context, Poll, Waker},

crates/core/src/conn/stream/handshake.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use std::future::Future;
21
use std::io::{Error as IoError, ErrorKind, Result as IoResult};
32
use std::pin::Pin;
43
use std::sync::Arc;

crates/core/src/extract/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ mod case;
6969
pub use case::RenameRule;
7070

7171
use std::fmt::Debug;
72-
use std::future::Future;
7372

7473
use crate::Writer;
7574
use crate::http::Request;

crates/core/src/fs/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ mod named_file;
33
pub use named_file::*;
44

55
use std::cmp;
6-
use std::future::Future;
76
use std::io::{self, Error as IoError, ErrorKind, Read, Result as IoResult, Seek};
87
use std::pin::Pin;
98
use std::task::{Context, Poll, ready};

crates/core/src/http/body/res.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use std::collections::VecDeque;
22
use std::fmt::{self, Debug};
3-
use std::future::Future;
43
use std::io::{Error as IoError, ErrorKind, Result as IoResult};
54
use std::pin::Pin;
65
use std::task::{self, Context, Poll, ready};

crates/core/src/http/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ pub use response::Response;
2222

2323
pub use http::version::Version;
2424

25-
use std::future::Future;
2625
use std::io::Result as IoResult;
2726
use std::sync::Arc;
2827

crates/core/src/server.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//! Server module
2-
use std::future::Future;
32
use std::io::Result as IoResult;
43
#[cfg(feature = "server-handle")]
54
use std::sync::atomic::{AtomicUsize, Ordering};

crates/core/src/service.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use std::future::Future;
21
use std::pin::Pin;
32
use std::sync::Arc;
43

crates/core/src/test/request/builder.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
use std::borrow::Borrow;
2-
use std::convert::TryInto;
3-
use std::future::Future;
42
use std::str;
53
use std::sync::Arc;
64

crates/core/src/test/response.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use std::borrow::Cow;
2-
use std::future::Future;
32
use std::io::{self, Result as IoResult, Write};
43

54
use bytes::{Bytes, BytesMut};

crates/csrf/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#![cfg_attr(docsrs, feature(doc_cfg))]
1212

1313
use std::error::Error as StdError;
14-
use std::future::Future;
1514

1615
mod finder;
1716

crates/extra/src/basic_auth.rs

-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
//! Server::new(acceptor).serve(router).await;
2828
//! }
2929
//! ```
30-
use std::future::Future;
31-
3230
use base64::engine::{general_purpose, Engine};
3331
use salvo_core::http::header::{HeaderName, AUTHORIZATION, PROXY_AUTHORIZATION};
3432
use salvo_core::http::{Request, Response, StatusCode};

crates/extra/src/sse.rs

-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ use serde::Serialize;
5151
use std::borrow::Cow;
5252
use std::error::Error as StdError;
5353
use std::fmt::{self, Display, Formatter, Write};
54-
use std::future::Future;
5554
use std::pin::Pin;
5655
use std::task::{Context, Poll};
5756
use std::time::Duration;

crates/extra/src/tower_compat.rs

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
//! ```
2525
use std::error::Error as StdError;
2626
use std::fmt;
27-
use std::future::Future;
2827
use std::io::{Error as IoError, ErrorKind};
2928
use std::marker::PhantomData;
3029
use std::sync::Arc;

crates/extra/src/websocket.rs

-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@
7878
//!```
7979
8080
use std::fmt::{self, Debug, Formatter};
81-
use std::future::Future;
8281
use std::pin::Pin;
8382
use std::task::{ready, Context, Poll};
8483

crates/flash/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#![cfg_attr(docsrs, feature(doc_cfg))]
77

88
use std::fmt::{self, Debug, Display, Formatter};
9-
use std::future::Future;
109
use std::ops::Deref;
1110

1211
use salvo_core::{Depot, FlowCtrl, Handler, Request, Response, async_trait};

crates/jwt-auth/src/decoder.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use jsonwebtoken::errors::Error as JwtError;
22
use jsonwebtoken::{Algorithm, DecodingKey, TokenData, Validation, decode};
33
use serde::Deserialize;
4-
use std::future::Future;
54

65
use salvo_core::Depot;
76

crates/jwt-auth/src/oidc/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//! Oidc(OpenID Connect) supports.
22
3-
use std::future::Future;
43
use std::str::FromStr;
54
use std::sync::Arc;
65
use std::time::SystemTime;

crates/oapi-macros/src/response/derive.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ impl TryToTokens for ToResponses<'_> {
174174
let ident = &self.ident;
175175
let (impl_generics, ty_generics, where_clause) = self.generics.split_for_impl();
176176

177-
let responses = if responses.len() > 0 {
177+
let responses = if !responses.is_empty() {
178178
quote!( #responses.into())
179179
} else {
180180
quote!( #oapi::oapi::Responses::new())

crates/oapi/docs/derive_to_parameters.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ The following attributes are available for use in on the container attribute `#[
3030
deriving `ToParameters`:
3131

3232
* `names(...)` Define comma separated list of names for unnamed fields of struct used as a path parameter.
33-
__Only__ supported on __unnamed structs__.
33+
__Only__ supported on __unnamed structs__.
3434
* `style = ...` Defines how all parameters are serialized by [`ParameterStyle`][style]. Default
35-
values are based on _`parameter_in`_ attribute.
35+
values are based on _`parameter_in`_ attribute.
3636
* `default_parameter_in = ...` = Defines default where the parameters of this field are used with a value from
37-
[`parameter::ParameterIn`][in_enum]. If this attribute is not supplied, then the default value is from query.
37+
[`parameter::ParameterIn`][in_enum]. If this attribute is not supplied, then the default value is from query.
3838
* `rename_all = ...` Can be provided to alternatively to the serde's `rename_all` attribute. Effectively provides same functionality.
3939

4040
Use `names` to define name for single unnamed argument.
@@ -62,7 +62,7 @@ The following attributes are available for use in the `#[salvo(parameter(...))]`
6262
* `style = ...` Defines how the parameter is serialized by [`ParameterStyle`][style]. Default values are based on _`parameter_in`_ attribute.
6363

6464
* `parameter_in = ...` = Defines where the parameters of this field are used with a value from
65-
[`parameter::ParameterIn`][in_enum]. If this attribute is not supplied, then the default value is from query.
65+
[`parameter::ParameterIn`][in_enum]. If this attribute is not supplied, then the default value is from query.
6666

6767
* `explode` Defines whether new _`parameter=value`_ pair is created for each parameter within _`object`_ or _`array`_.
6868

@@ -74,8 +74,8 @@ The following attributes are available for use in the `#[salvo(parameter(...))]`
7474
* `value_type = ...` Can be used to override default type derived from type of the field used in OpenAPI spec.
7575
This is useful in cases where the default type does not correspond to the actual type e.g. when
7676
any third-party types are used which are not [`ToSchema`][to_schema]s nor [`primitive` types][primitive].
77-
Value can be any Rust type what normally could be used to serialize to JSON or custom type such as _`Object`_.
78-
_`Object`_ will be rendered as generic OpenAPI object.
77+
Value can be any Rust type what normally could be used to serialize to JSON or custom type such as _`Object`_.
78+
_`Object`_ will be rendered as generic OpenAPI object.
7979

8080
* `inline` If set, the schema for this field's type needs to be a [`ToSchema`][to_schema], and
8181
the schema definition will be inlined.
@@ -93,7 +93,7 @@ The following attributes are available for use in the `#[salvo(parameter(...))]`
9393
* `nullable` Defines property is nullable (note this is different to non-required).
9494

9595
* `required = ...` Can be used to enforce required status for the parameter. [See
96-
rules][derive@ToParameters#field-nullability-and-required-rules]
96+
rules][derive@ToParameters#field-nullability-and-required-rules]
9797

9898
* `rename = ...` Can be provided to alternatively to the serde's `rename` attribute. Effectively provides same functionality.
9999

crates/oapi/docs/endpoint.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ _**Example request body definitions.**_
137137
_`serde_json::json!`_ can parse as a _`serde_json::Value`_.
138138

139139
* `response = ...` Type what implements [`ToResponse`][to_response_trait] trait. This can alternatively be used to
140-
define response attributes. _`response`_ attribute cannot co-exist with other than _`status_code`_ attribute.
140+
define response attributes. _`response`_ attribute cannot co-exist with other than _`status_code`_ attribute.
141141

142142
* `content((...), (...))` Can be used to define multiple return types for single response status code. Supported format for single
143143
_content_ is `(content_type = response_body, example = "...", examples(...))`. _`example`_
@@ -324,7 +324,7 @@ tuples separated by commas:
324324
E.g. _`Path, Query, Header, Cookie`_
325325

326326
* `deprecated` Define whether the parameter is deprecated or not. Can optionally be defined
327-
with explicit `bool` value as _`deprecated = bool`_.
327+
with explicit `bool` value as _`deprecated = bool`_.
328328

329329
* `description = "..."` Define possible description for the parameter as str.
330330

crates/proxy/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636

3737
use std::convert::Infallible;
3838
use std::error::Error as StdError;
39-
use std::future::Future;
4039

4140
use hyper::upgrade::OnUpgrade;
4241
use percent_encoding::{CONTROLS, utf8_percent_encode};

crates/rate-limiter/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
use std::borrow::Borrow;
1919
use std::error::Error as StdError;
20-
use std::future::Future;
2120
use std::hash::Hash;
2221

2322
use salvo_core::conn::SocketAddr;

crates/rate-limiter/src/quota.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use std::borrow::Borrow;
22
use std::convert::Infallible;
33
use std::error::Error as StdError;
4-
use std::future::Future;
54
use std::hash::Hash;
65

76
use serde::{Deserialize, Serialize};

crates/serve-static/src/dir.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -402,13 +402,7 @@ impl Handler for StaticDir {
402402
.unwrap_or_default();
403403
let accept_algos = http::parse_accept_encoding(header)
404404
.into_iter()
405-
.filter_map(|(algo, _level)| {
406-
if let Ok(algo) = algo.parse::<CompressionAlgo>() {
407-
Some(algo)
408-
} else {
409-
None
410-
}
411-
})
405+
.filter_map(|(algo, _level)| algo.parse::<CompressionAlgo>().ok())
412406
.collect::<HashSet<_>>();
413407
for (algo, exts) in &self.compressed_variations {
414408
if accept_algos.contains(algo) {

0 commit comments

Comments
 (0)