Skip to content

Commit a732a1f

Browse files
committed
clippy::use-self
1 parent ff309f4 commit a732a1f

File tree

6 files changed

+15
-15
lines changed

6 files changed

+15
-15
lines changed

src/cookies/middleware.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ impl CookieData {
9090
}
9191
}
9292

93-
CookieData {
93+
Self {
9494
content: Arc::new(RwLock::new(jar)),
9595
}
9696
}

src/request.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ impl<State> Request<State> {
3232
state: Arc<State>,
3333
request: http_types::Request,
3434
route_params: Vec<Params>,
35-
) -> Request<State> {
36-
Request {
35+
) -> Self {
36+
Self {
3737
state,
3838
request,
3939
route_params,

src/response.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ impl Response {
174174
pub async fn body_form<T: serde::Serialize>(
175175
mut self,
176176
form: T,
177-
) -> Result<Response, serde_qs::Error> {
177+
) -> Result<Self, serde_qs::Error> {
178178
// TODO: think about how to handle errors
179179
self.res.set_body(serde_qs::to_string(&form)?.into_bytes());
180180
Ok(self

src/router.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ pub(crate) struct Selection<'a, State> {
2222
}
2323

2424
impl<State: 'static> Router<State> {
25-
pub(crate) fn new() -> Router<State> {
26-
Router {
25+
pub(crate) fn new() -> Self {
26+
Self {
2727
method_map: HashMap::default(),
2828
all_method_router: MethodRouter::new(),
2929
}

src/security/cors.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -213,15 +213,15 @@ pub enum Origin {
213213
impl From<String> for Origin {
214214
fn from(s: String) -> Self {
215215
if s == "*" {
216-
return Origin::Any;
216+
return Self::Any;
217217
}
218-
Origin::Exact(s)
218+
Self::Exact(s)
219219
}
220220
}
221221

222222
impl From<&str> for Origin {
223223
fn from(s: &str) -> Self {
224-
Origin::from(s.to_string())
224+
Self::from(s.to_string())
225225
}
226226
}
227227

@@ -231,13 +231,13 @@ impl From<Vec<String>> for Origin {
231231
return Self::from(list[0].clone());
232232
}
233233

234-
Origin::List(list)
234+
Self::List(list)
235235
}
236236
}
237237

238238
impl From<Vec<&str>> for Origin {
239239
fn from(list: Vec<&str>) -> Self {
240-
Origin::from(
240+
Self::from(
241241
list.iter()
242242
.map(|s| (*s).to_string())
243243
.collect::<Vec<String>>(),

src/server.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,13 @@ impl Server<()> {
151151
/// # Ok(()) }) }
152152
/// ```
153153
#[must_use]
154-
pub fn new() -> Server<()> {
154+
pub fn new() -> Self {
155155
Self::with_state(())
156156
}
157157
}
158158

159159
impl Default for Server<()> {
160-
fn default() -> Server<()> {
160+
fn default() -> Self {
161161
Self::new()
162162
}
163163
}
@@ -194,8 +194,8 @@ impl<State: Send + Sync + 'static> Server<State> {
194194
/// #
195195
/// # Ok(()) }) }
196196
/// ```
197-
pub fn with_state(state: State) -> Server<State> {
198-
let mut server = Server {
197+
pub fn with_state(state: State) -> Self {
198+
let mut server = Self {
199199
router: Arc::new(Router::new()),
200200
middleware: Arc::new(vec![]),
201201
state: Arc::new(state),

0 commit comments

Comments
 (0)