Skip to content

Commit

Permalink
refactor: address clippy errors
Browse files Browse the repository at this point in the history
Signed-off-by: Tiago Castro <[email protected]>
  • Loading branch information
tiagolobocastro committed Feb 19, 2025
1 parent 74d317e commit f3ce448
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 26 deletions.
4 changes: 2 additions & 2 deletions core/src/v2/actix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,8 @@ impl_empty!(HttpRequest, HttpResponse, Bytes, Payload);
mod manual_impl {
use super::OperationModifier;

impl<'a> OperationModifier for &'a str {}
impl<'a, T: OperationModifier> OperationModifier for &'a [T] {}
impl OperationModifier for &str {}
impl<T: OperationModifier> OperationModifier for &[T] {}

macro_rules! impl_simple({ $ty:ty } => {
impl OperationModifier for $ty {}
Expand Down
2 changes: 1 addition & 1 deletion core/src/v2/extensions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ impl<'de> Deserialize<'de> for MediaRange {
{
struct Visitor;

impl<'de> serde::de::Visitor<'de> for Visitor {
impl serde::de::Visitor<'_> for Visitor {
type Value = MediaRange;

fn expecting(&self, f: &mut fmt::Formatter) -> fmt::Result {
Expand Down
5 changes: 2 additions & 3 deletions core/src/v2/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ where
}
};

if let Some(inner) = schema.items_mut().take() {
if let Some(inner) = schema.items_mut() {
return self.resolve_definitions(inner);
}

if let Some(props) = schema.properties_mut().take() {
if let Some(props) = schema.properties_mut() {
props.iter_mut().try_for_each(|(k, s)| {
log::trace!("Resolving property {:?}", k);
self.resolve_definitions(s)
Expand All @@ -128,7 +128,6 @@ where

if let Some(props) = schema
.additional_properties_mut()
.take()
.and_then(|s| s.right_mut())
{
self.resolve_definitions(props)?;
Expand Down
6 changes: 3 additions & 3 deletions core/src/v2/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,13 @@ macro_rules! impl_type_simple {
};
}

impl<'a> TypedData for &'a str {
impl TypedData for &str {
fn data_type() -> DataType {
DataType::String
}
}

impl<'a, T: TypedData> TypedData for &'a T {
impl<T: TypedData> TypedData for &T {
fn data_type() -> DataType {
T::data_type()
}
Expand Down Expand Up @@ -528,7 +528,7 @@ impl<T: Apiv2Schema + Clone> Apiv2Schema for std::borrow::Cow<'_, T> {
}
}

impl<'a, T: Apiv2Schema> Apiv2Schema for &'a [T] {
impl<T: Apiv2Schema> Apiv2Schema for &[T] {
fn raw_schema() -> DefaultSchemaRaw {
Vec::<T>::raw_schema()
}
Expand Down
4 changes: 2 additions & 2 deletions plugins/actix-web/src/web.rs
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ impl<'a> From<&'a mut actix_web::web::ServiceConfig> for ServiceConfig<'a> {
}
}

impl<'a> Mountable for ServiceConfig<'a> {
impl Mountable for ServiceConfig<'_> {
fn path(&self) -> &str {
unimplemented!("ServiceConfig has multiple paths. Use `update_operations` object instead.");
}
Expand All @@ -725,7 +725,7 @@ impl<'a> Mountable for ServiceConfig<'a> {
}
}

impl<'a> ServiceConfig<'a> {
impl ServiceConfig<'_> {
/// Wrapper for [`actix_web::web::ServiceConfig::route`](https://docs.rs/actix-web/*/actix_web/web/struct.ServiceConfig.html#method.route).
pub fn route(&mut self, path: &str, route: Route) -> &mut Self {
let mut w = RouteWrapper::from(path, route);
Expand Down
2 changes: 1 addition & 1 deletion shell.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ profile ? "stable", date ? "2023-08-03", oxalica ? "99df490", rustup ? true }:
{ profile ? "stable", date ? "2025-02-19", oxalica ? "75b2271c", rustup ? true }:
let
oxalica_overlay = builtins.fetchTarball "https://github.com/oxalica/rust-overlay/archive/${oxalica}.tar.gz";
pkgs = import <nixpkgs> {
Expand Down
6 changes: 3 additions & 3 deletions src/v2/codegen/emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,15 +364,15 @@ struct CodegenEmitter<'a, E>(&'a E)
where
Self: Sized;

impl<'a, E> Deref for CodegenEmitter<'a, E> {
impl<E> Deref for CodegenEmitter<'_, E> {
type Target = E;

fn deref(&self) -> &E {
self.0
}
}

impl<'a, E> CodegenEmitter<'a, E>
impl<E> CodegenEmitter<'_, E>
where
E: Emitter,
E::Definition: Debug,
Expand Down Expand Up @@ -721,7 +721,7 @@ struct RequirementCollector<'a, E: Emitter> {
template_params: HashSet<String>,
}

impl<'a, E> RequirementCollector<'a, E>
impl<E> RequirementCollector<'_, E>
where
E: Emitter,
E::Definition: Debug,
Expand Down
10 changes: 5 additions & 5 deletions src/v2/codegen/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ impl ApiObject {
}
}

impl<'a> ApiObjectImpl<'a> {
impl ApiObjectImpl<'_> {
/// Writes the required "clap" subcommand for this object in YAML.
pub(super) fn write_clap_yaml<F>(&self, f: &mut F) -> fmt::Result
where
Expand Down Expand Up @@ -348,7 +348,7 @@ impl<'a> ApiObjectImpl<'a> {
/// Represents the API object builder impl.
pub struct ApiObjectBuilderImpl<'a, 'b>(&'a ApiObjectBuilder<'b>);

impl<'a> ApiObjectBuilder<'a> {
impl ApiObjectBuilder<'_> {
/// Returns a struct representing the impl for this builder.
pub fn impl_repr(&self) -> ApiObjectBuilderImpl<'_, '_> {
ApiObjectBuilderImpl(self)
Expand Down Expand Up @@ -692,7 +692,7 @@ impl<'a, 'b> From<&'a ApiObjectBuilder<'b>> for SendableCodegen<'a, 'b> {
}
}

impl<'a, 'b> SendableCodegen<'a, 'b> {
impl SendableCodegen<'_, '_> {
/// Determine and write `Sendable` impl (if it's needed for this builder).
fn write_impl_if_needed<F>(mut self, f: &mut F) -> fmt::Result
where
Expand Down Expand Up @@ -1145,7 +1145,7 @@ impl<'a, 'b> SendableCodegen<'a, 'b> {
}
}

impl<'a> Display for ApiObjectImpl<'a> {
impl Display for ApiObjectImpl<'_> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
if self.builders.is_empty() {
return Ok(());
Expand Down Expand Up @@ -1178,7 +1178,7 @@ impl<'a> Display for ApiObjectImpl<'a> {
}
}

impl<'a, 'b> Display for ApiObjectBuilderImpl<'a, 'b> {
impl Display for ApiObjectBuilderImpl<'_, '_> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let mut generics = String::new();
self.0
Expand Down
2 changes: 1 addition & 1 deletion src/v2/codegen/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,7 @@ impl<'a> ApiObjectBuilder<'a> {
}
}

impl<'a> Display for ApiObjectBuilder<'a> {
impl Display for ApiObjectBuilder<'_> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str("/// Builder ")?;
if let (Some(name), Some(m)) = (self.constructor_fn_name(), self.method) {
Expand Down
10 changes: 5 additions & 5 deletions tests/test_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ use std::{
thread,
};

static CLIENT: Lazy<reqwest::blocking::Client> = Lazy::new(|| reqwest::blocking::Client::new());
static CLIENT: Lazy<reqwest::blocking::Client> = Lazy::new(reqwest::blocking::Client::new);
static PORTS: Lazy<Mutex<HashSet<u16>>> = Lazy::new(|| Mutex::new(HashSet::new()));

use uuid0_dev::Uuid;
Expand Down Expand Up @@ -4621,8 +4621,8 @@ where
});

let addr = rx.recv().unwrap();
let ret = check(addr);
ret

check(addr)
}

#[cfg(not(feature = "actix4"))]
Expand Down Expand Up @@ -4684,8 +4684,8 @@ fn check_json(resp: reqwest::blocking::Response, expected: serde_json::Value) {
right: {}
",
json.to_string(),
expected.to_string()
json,
expected
)
}
}
Expand Down

0 comments on commit f3ce448

Please sign in to comment.