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

Minor: Clippy router now uses types OnFormData and OnResponse. #484

Merged
merged 1 commit into from
Feb 7, 2023

Conversation

martinfrances107
Copy link
Contributor

@martinfrances107 martinfrances107 commented Feb 7, 2023

On my version of clippy ( 0.1.69 )

The '#allow' is not being recognised.

 #[allow(clippy::type_complexity)] on_response: Option<Rc<dyn Fn(&web_sys::Response)>>,

as I see this warning

warning: very complex type used. Consider factoring parts into `type` definitions
  --> router/src/components/form.rs:57:56
   |
57 |         #[allow(clippy::type_complexity)] on_response: Option<Rc<dyn Fn(&web_sys::Response)>>,
   |                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity

I propose two new types,

type OnFormData = Rc<dyn Fn(&web_sys::FormData)>;
type OnResponse = Rc<dyn Fn(&web_sys::Response)>;

Each type is referenced twice in the code base.

@gbj gbj merged commit e59ee63 into leptos-rs:main Feb 7, 2023
@martinfrances107 martinfrances107 deleted the clippy_types branch February 8, 2023 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants