Skip to content

Commit

Permalink
style: make clippy happy
Browse files Browse the repository at this point in the history
  • Loading branch information
Kilerd committed Dec 19, 2024
1 parent 15640ec commit fe42a06
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 1 addition & 2 deletions gotcha/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ pub trait GotchaApp: Sized + Send + Sync {

let context = GotchaContext { config: config.clone(), state };

let router = GotchaRouter::<GotchaContext<Self::State, Self::Config>>::new();
let router = GotchaRouter::<GotchaContext<Self::State, Self::Config>>::default();
let router = self.routes(router);

let GotchaRouter {
Expand All @@ -124,7 +124,6 @@ pub trait GotchaApp: Sized + Send + Sync {
.with_state(context.clone());
}
}

let mut task_scheduler = TaskScheduler::new(context.clone());
self.tasks(&mut task_scheduler).await?;

Expand Down
10 changes: 7 additions & 3 deletions gotcha/src/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,19 @@ pub struct GotchaRouter<State = ()> {
pub(crate) operations: HashMap<(String, Method), Operation>,
pub(crate) router: Router<State>,
}

impl<State: Clone + Send + Sync + 'static> GotchaRouter<State> {
pub fn new() -> Self {
impl<State: Clone + Send + Sync + 'static> Default for GotchaRouter<State> {
fn default() -> Self {
Self {
#[cfg(feature = "openapi")]
operations: Default::default(),
router: Router::new(),
}
}
}

impl<State: Clone + Send + Sync + 'static> GotchaRouter<State> {


pub fn route(self, path: &str, method_router: MethodRouter<State>) -> Self {
Self {
#[cfg(feature = "openapi")]
Expand Down

0 comments on commit fe42a06

Please sign in to comment.