Skip to content

Commit 88a2aa2

Browse files
committed
fix clippy warning from 1.51
some of these should be actually changed in a PR...
1 parent a3c9ae3 commit 88a2aa2

File tree

7 files changed

+10
-4
lines changed

7 files changed

+10
-4
lines changed

examples/json.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ async fn main() -> tide::Result<()> {
2020
name: "chashu".into(),
2121
};
2222

23-
Ok(Body::from_json(&cat)?)
23+
Body::from_json(&cat)
2424
});
2525

2626
app.at("/animals").get(|_| async {

src/listener/to_listener.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,6 @@ pub trait ToListener<State: Clone + Send + Sync + 'static> {
5757
/// listener does not initiate a connection. An Err return
5858
/// indicates an unsuccessful conversion to a listener, not an
5959
/// unsuccessful bind attempt.
60+
#[allow(clippy::wrong_self_convention)]
6061
fn to_listener(self) -> io::Result<Self::Listener>;
6162
}

src/redirect.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,14 @@ where
9696
}
9797
}
9898

99+
#[allow(clippy::from_over_into)]
99100
impl<T: AsRef<str>> Into<Response> for Redirect<T> {
100101
fn into(self) -> Response {
101102
(&self).into()
102103
}
103104
}
104105

106+
#[allow(clippy::from_over_into)]
105107
impl<T: AsRef<str>> Into<Response> for &Redirect<T> {
106108
fn into(self) -> Response {
107109
let mut res = Response::new(self.status);

src/request.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -570,20 +570,21 @@ impl<State> Read for Request<State> {
570570
}
571571
}
572572

573+
#[allow(clippy::from_over_into)]
573574
impl<State> Into<http::Request> for Request<State> {
574575
fn into(self) -> http::Request {
575576
self.req
576577
}
577578
}
578579

580+
#[allow(clippy::from_over_into)]
579581
impl<State: Default> Into<Request<State>> for http_types::Request {
580582
fn into(self) -> Request<State> {
581583
Request::new(State::default(), self, Vec::<Params>::new())
582584
}
583585
}
584586

585-
// NOTE: From cannot be implemented for this conversion because `State` needs to
586-
// be constrained by a type.
587+
#[allow(clippy::from_over_into)]
587588
impl<State: Clone + Send + Sync + 'static> Into<Response> for Request<State> {
588589
fn into(mut self) -> Response {
589590
let mut res = Response::new(StatusCode::Ok);

src/response.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ impl AsMut<http::Headers> for Response {
356356
}
357357
}
358358

359+
#[allow(clippy::from_over_into)]
359360
impl Into<http::Response> for Response {
360361
fn into(self) -> http_types::Response {
361362
self.res

src/response_builder.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ impl ResponseBuilder {
7777
}
7878
}
7979

80+
#[allow(clippy::from_over_into)]
8081
impl Into<Response> for ResponseBuilder {
8182
fn into(self) -> Response {
8283
self.build()

tests/server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ fn json() -> tide::Result<()> {
7979
let mut counter: Counter = req.body_json().await.unwrap();
8080
assert_eq!(counter.count, 0);
8181
counter.count = 1;
82-
Ok(Body::from_json(&counter)?)
82+
Body::from_json(&counter)
8383
});
8484
app.listen(("localhost", port)).await?;
8585
Result::<(), http_types::Error>::Ok(())

0 commit comments

Comments
 (0)