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: examples/todomvc - Rename Todos::new() as Todos::default(). #2390

Merged
merged 1 commit into from
Mar 3, 2024

Conversation

martinfrances107
Copy link
Contributor

@martinfrances107 martinfrances107 commented Mar 1, 2024

This is just a minor point seen while copying code snippets from the examples directory

Here is a snippet from this clippy rule new_without_default

struct Foo(Bar);

impl Foo {
fn new() -> Self {
Foo(Bar::new())
}
}
Instead, use:

struct Foo(Bar);

impl Default for Foo {
fn default() -> Self {
Foo(Bar::new())
}
}

both new() and default() are not needed - when just default() will suffice.

@benwis
Copy link
Contributor

benwis commented Mar 3, 2024

LGTM thanks for the contribution!

@benwis benwis merged commit 4bb43f6 into leptos-rs:main Mar 3, 2024
10 checks passed
@martinfrances107 martinfrances107 deleted the default branch March 5, 2024 12: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.

2 participants