Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove #[allow(unused_mut)] #231

Merged
merged 1 commit into from
May 16, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions examples/src/body_types.rs
Original file line number Diff line number Diff line change
@@ -11,28 +11,24 @@ struct Message {
contents: String,
}

#[allow(unused_mut)] // Workaround clippy bug
async fn echo_string(mut cx: Context<()>) -> String {
let msg = cx.body_string().await.unwrap();
println!("String: {}", msg);
msg
}

#[allow(unused_mut)] // Workaround clippy bug
async fn echo_bytes(mut cx: Context<()>) -> Vec<u8> {
let msg = cx.body_bytes().await.unwrap();
println!("Bytes: {:?}", msg);
msg
}

#[allow(unused_mut)] // Workaround clippy bug
async fn echo_json(mut cx: Context<()>) -> EndpointResult {
let msg = cx.body_json().await.client_err()?;
println!("JSON: {:?}", msg);
Ok(response::json(msg))
}

#[allow(unused_mut)] // Workaround clippy bug
async fn echo_form(mut cx: Context<()>) -> EndpointResult {
let msg = cx.body_form().await?;
println!("Form: {:?}", msg);
2 changes: 0 additions & 2 deletions examples/src/cookies.rs
Original file line number Diff line number Diff line change
@@ -6,12 +6,10 @@ async fn retrieve_cookie(mut cx: Context<()>) -> String {
format!("hello cookies: {:?}", cx.get_cookie("hello").unwrap())
}

#[allow(unused_mut)] // Workaround clippy bug
async fn set_cookie(mut cx: Context<()>) {
cx.set_cookie(Cookie::new("hello", "world")).unwrap();
}

#[allow(unused_mut)] // Workaround clippy bug
async fn remove_cookie(mut cx: Context<()>) {
cx.remove_cookie(Cookie::named("hello")).unwrap();
}
2 changes: 0 additions & 2 deletions examples/src/messages.rs
Original file line number Diff line number Diff line change
@@ -37,13 +37,11 @@ impl Database {
}
}

#[allow(unused_mut)] // Workaround clippy bug
async fn new_message(mut cx: Context<Database>) -> EndpointResult<String> {
let msg = cx.body_json().await.client_err()?;
Ok(cx.state().insert(msg).to_string())
}

#[allow(unused_mut)] // Workaround clippy bug
async fn set_message(mut cx: Context<Database>) -> EndpointResult<()> {
let msg = cx.body_json().await.client_err()?;
let id = cx.param("id").client_err()?;
1 change: 0 additions & 1 deletion examples/src/multipart_form/mod.rs
Original file line number Diff line number Diff line change
@@ -9,7 +9,6 @@ struct Message {
file: Option<String>,
}

#[allow(unused_mut)] // Workaround clippy bug
async fn upload_file(mut cx: Context<()>) -> EndpointResult {
// https://stackoverflow.com/questions/43424982/how-to-parse-multipart-forms-using-abonander-multipart-with-rocket
let mut message = Message {
4 changes: 0 additions & 4 deletions tide/src/middleware/cookies.rs
Original file line number Diff line number Diff line change
@@ -72,23 +72,19 @@ mod tests {
static COOKIE_NAME: &str = "testCookie";

/// Tide will use the the `Cookies`'s `Extract` implementation to build this parameter.
#[allow(unused_mut)] // Workaround clippy bug
async fn retrieve_cookie(mut cx: Context<()>) -> String {
format!("{}", cx.get_cookie(COOKIE_NAME).unwrap().unwrap().value())
}

#[allow(unused_mut)] // Workaround clippy bug
async fn set_cookie(mut cx: Context<()>) {
cx.set_cookie(Cookie::new(COOKIE_NAME, "NewCookieValue"))
.unwrap();
}

#[allow(unused_mut)] // Workaround clippy bug
async fn remove_cookie(mut cx: Context<()>) {
cx.remove_cookie(Cookie::named(COOKIE_NAME)).unwrap();
}

#[allow(unused_mut)] // Workaround clippy bug
async fn set_multiple_cookie(mut cx: Context<()>) {
cx.set_cookie(Cookie::new("C1", "V1")).unwrap();
cx.set_cookie(Cookie::new("C2", "V2")).unwrap();