Skip to content

Commit

Permalink
Bump Clippy version to 1.63 (#600)
Browse files Browse the repository at this point in the history
  • Loading branch information
msrd0 committed Sep 2, 2022
1 parent b6efb77 commit 84c7f08
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@master
with:
toolchain: "1.58"
toolchain: "1.63"
components: clippy

- name: Get Rust Version
Expand Down
4 changes: 4 additions & 0 deletions examples/diesel/src/models.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
//! Holds the two possible structs that are `Queryable` and
//! `Insertable` in the DB

// This warning is triggered by diesel's derive macros
#![allow(clippy::extra_unused_lifetimes)]

use diesel::{Insertable, Queryable};
use serde::{Deserialize, Serialize};

Expand Down
4 changes: 1 addition & 3 deletions examples/sessions/introduction/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
//! An introduction to storing and retrieving session data, in a type safe way, with the Gotham
//! web framework.

#![cfg_attr(feature = "cargo-clippy", allow(clippy::get_unwrap))]

use gotham::middleware::session::{NewSessionMiddleware, SessionData};
use gotham::pipeline::{new_pipeline, single_pipeline};
use gotham::prelude::*;
Expand Down Expand Up @@ -87,7 +85,7 @@ mod tests {
.flat_map(|hv| hv.to_str())
.collect();
assert!(set_cookie.len() == 1);
set_cookie.get(0).unwrap().to_string().parse().unwrap()
set_cookie.first().unwrap().to_string().parse().unwrap()
};

let body = response.read_body().unwrap();
Expand Down
10 changes: 5 additions & 5 deletions gotham/src/handler/assets/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub struct FileHandler {
///
/// assert_eq!(default_options, from_builder);
/// ```
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct FileOptions {
path: PathBuf,
cache_control: String,
Expand Down Expand Up @@ -121,18 +121,18 @@ impl FileOptions {
/// which have a constraint `FileOptions: From<P>` for default options.
macro_rules! derive_from {
($type:ty) => {
impl<'a> From<$type> for FileOptions {
impl From<$type> for FileOptions {
fn from(t: $type) -> FileOptions {
FileOptions::new(t)
}
}
};
}

derive_from!(&'a Path);
derive_from!(&Path);
derive_from!(PathBuf);
derive_from!(&'a str);
derive_from!(&'a String);
derive_from!(&str);
derive_from!(&String);
derive_from!(String);

impl FileHandler {
Expand Down
4 changes: 2 additions & 2 deletions gotham/src/helpers/http/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use log::trace;
use percent_encoding::percent_decode;

/// Represents data that has been successfully percent decoded and is valid UTF-8
#[derive(Clone, PartialEq, Debug)]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct PercentDecoded {
val: String,
}
Expand Down Expand Up @@ -45,7 +45,7 @@ impl AsRef<str> for PercentDecoded {
/// Decode form-urlencoded strings (e.g. query string, or request body with Content-Type:
/// application/x-www-form-urlencoded
fn form_url_decode(raw: &str) -> Result<String, std::str::Utf8Error> {
match percent_decode(raw.replace("+", " ").as_bytes()).decode_utf8() {
match percent_decode(raw.replace('+', " ").as_bytes()).decode_utf8() {
Ok(pd) => {
trace!(" form_url_decode: {}, src: {}", pd, raw);
Ok(pd.into_owned())
Expand Down
2 changes: 1 addition & 1 deletion gotham/src/helpers/http/request/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const EXCLUDED_SEGMENTS: [&str; 1] = [""];
/// Holder for `Request` URI path segments that have been split into individual segments.
///
/// Used internally by the `Router` when traversing its internal `Tree`.
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct RequestPathSegments {
segments: Vec<PercentDecoded>,
}
Expand Down
4 changes: 2 additions & 2 deletions gotham/src/middleware/session/backend/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ mod tests {
.expect("failed to persist");

{
let mut storage = backend.storage.lock().expect("couldn't lock storage");
let storage = backend.storage.lock().expect("couldn't lock storage");
assert_eq!(
storage.front().expect("no front element").0,
&identifier.value
Expand All @@ -295,7 +295,7 @@ mod tests {

{
// Identifiers have swapped
let mut storage = backend.storage.lock().expect("couldn't lock storage");
let storage = backend.storage.lock().expect("couldn't lock storage");
assert_eq!(
storage.front().expect("no front element").0,
&identifier2.value
Expand Down
2 changes: 1 addition & 1 deletion gotham/src/pipeline/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub trait PipelineHandleChain<P>: RefUnwindSafe {
}

/// Part of a `PipelineHandleChain` which references a `Pipeline` and continues with a tail element.
impl<'a, P, T, N, U> PipelineHandleChain<P> for (Handle<Pipeline<T>, N>, U)
impl<P, T, N, U> PipelineHandleChain<P> for (Handle<Pipeline<T>, N>, U)
where
T: NewMiddlewareChain,
T::Instance: Send + 'static,
Expand Down
2 changes: 1 addition & 1 deletion gotham/src/router/route/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use crate::router::route::matcher::RouteMatcher;
use crate::router::tree::segment::SegmentMapping;
use crate::state::{request_id, State};

#[derive(Clone, Copy, PartialEq)]
#[derive(Clone, Copy, Eq, PartialEq)]
/// Indicates whether this `Route` will dispatch the request to an inner `Router` instance. To
/// support inner `Router` instances which handle a subtree, the `Dispatcher` stores additional
/// context information.
Expand Down

0 comments on commit 84c7f08

Please sign in to comment.