Skip to content

Commit

Permalink
fix Rust warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
oscartbeaumont committed Oct 1, 2022
1 parent 4dd190a commit 6b0c036
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 22 deletions.
2 changes: 1 addition & 1 deletion examples/src/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pub fn mount() -> RouterBuilder {
Router::new()
.query("version", |t| t(|_, _: ()| env!("CARGO_PKG_VERSION")))
.query("echo", |t| t(|_, v: String| v))
.query("echoAsync", |t| t(|ctx, _: i32| async move { 42 }))
.query("echoAsync", |t| t(|_, _: i32| async move { 42 }))
.query("error", |t| {
t(|_, _: ()| {
Err(rspc::Error::new(
Expand Down
4 changes: 1 addition & 3 deletions examples/src/bin/global_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ use std::{
},
};

use rspc::{Config, Router, Type};
use serde::Serialize;
use serde_json::{json, Value};
use rspc::{Config, Router};

#[derive(Clone)]
pub struct MyCtx {
Expand Down
2 changes: 1 addition & 1 deletion examples/src/bin/middleware.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ async fn main() {
})
// Reject all middleware
.middleware(|mw| {
mw.middleware(|mw| async move {
mw.middleware(|_mw| async move {
Err(rspc::Error::new(
ErrorCode::Unauthorized,
"Unauthorized".into(),
Expand Down
3 changes: 0 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 14 additions & 14 deletions src/integrations/httpz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,9 +396,9 @@ where
};
let ctx = match ctx {
Ok(v) => v,
Err(e) => {
Err(_err) => {
#[cfg(feature = "tracing")]
tracing::error!("Error executing context function: {}", e);
tracing::error!("Error executing context function: {}", _err);

return Ok((
Response::builder()
Expand Down Expand Up @@ -451,9 +451,9 @@ where
.status(StatusCode::OK)
.header("Content-Type", "application/json")
.body(v)?,
Err(e) => {
Err(_err) => {
#[cfg(feature = "tracing")]
tracing::error!("Error serializing response: {}", e);
tracing::error!("Error serializing response: {}", _err);

Response::builder()
.status(StatusCode::INTERNAL_SERVER_ERROR)
Expand Down Expand Up @@ -492,17 +492,17 @@ where
msg = rx.recv() => {
match socket.send(Message::Text(match serde_json::to_string(&msg) {
Ok(v) => v,
Err(err) => {
Err(_err) => {
#[cfg(feature = "tracing")]
tracing::error!("Error serializing websocket message: {}", err);
tracing::error!("Error serializing websocket message: {}", _err);

continue;
}
})).await {
Ok(_) => {}
Err(err) => {
Err(_err) => {
#[cfg(feature = "tracing")]
tracing::error!("Error sending websocket message: {}", err);
tracing::error!("Error sending websocket message: {}", _err);

continue;
}
Expand All @@ -526,17 +526,17 @@ where

match res {
Ok(v) => v,
Err(err) => {
Err(_err) => {
#[cfg(feature = "tracing")]
tracing::error!("Error parsing websocket message: {}", err);
tracing::error!("Error parsing websocket message: {}", _err);

continue;
}
}
}
Some(Err(err)) => {
Some(Err(_err)) => {
#[cfg(feature = "tracing")]
tracing::error!("Error in websocket: {}", err);
tracing::error!("Error in websocket: {}", _err);

continue;
},
Expand All @@ -555,9 +555,9 @@ where

handle_json_rpc(match ctx {
Ok(v) => v,
Err(e) => {
Err(_err) => {
#[cfg(feature = "tracing")]
tracing::error!("Error executing context function: {}", e);
tracing::error!("Error executing context function: {}", _err);

continue;
}
Expand Down

0 comments on commit 6b0c036

Please sign in to comment.