Skip to content

[Merged by Bors] - Replace .insert_resource(T::default()) calls with init_resource::<T>()#2807

Closed
MinerSebas wants to merge 1 commit intobevyengine:mainfrom
MinerSebas:replace_insert_resource
Closed

[Merged by Bors] - Replace .insert_resource(T::default()) calls with init_resource::<T>()#2807
MinerSebas wants to merge 1 commit intobevyengine:mainfrom
MinerSebas:replace_insert_resource

Conversation

@MinerSebas
Copy link
Contributor

Objective

I added the INSERT_RESOURCE_WITH_DEFAULT Lint to bevy_lint and while Testing it on bevy itself, I found several places where the Lint correctly triggered.

Solution

Replace .insert_resource(T::default()) calls with init_resource::<T>()

@github-actions github-actions bot added the S-Needs-Triage This issue needs to be labelled label Sep 11, 2021
@DJMcNab DJMcNab added C-Code-Quality A section of code that is hard to understand or change and removed S-Needs-Triage This issue needs to be labelled labels Sep 11, 2021
@NiklasEi NiklasEi added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Sep 12, 2021
@cart
Copy link
Member

cart commented Sep 12, 2021

Awesome. Very cool to see bevy_lint yielding fruit in the bevy repo!

@cart
Copy link
Member

cart commented Sep 12, 2021

bors r+

bors bot pushed a commit that referenced this pull request Sep 12, 2021
…T>()` (#2807)

# Objective

I added the [INSERT_RESOURCE_WITH_DEFAULT](https://minersebas.github.io/bevy_lint/bevy_lint/static.INSERT_RESOURCE_WITH_DEFAULT.html) Lint to [bevy_lint](https://github.com/MinerSebas/bevy_lint) and while Testing it on bevy itself, I found several places where the Lint correctly triggered.



## Solution

Replace `.insert_resource(T::default())` calls with `init_resource::<T>()`
@bors
Copy link
Contributor

bors bot commented Sep 12, 2021

Build failed:

@MinerSebas
Copy link
Contributor Author

MinerSebas commented Sep 12, 2021

@cart CI broke due to a nightly change, which is fixed by #2811

@mockersf
Copy link
Member

bors r+

bors bot pushed a commit that referenced this pull request Sep 13, 2021
…T>()` (#2807)

# Objective

I added the [INSERT_RESOURCE_WITH_DEFAULT](https://minersebas.github.io/bevy_lint/bevy_lint/static.INSERT_RESOURCE_WITH_DEFAULT.html) Lint to [bevy_lint](https://github.com/MinerSebas/bevy_lint) and while Testing it on bevy itself, I found several places where the Lint correctly triggered.



## Solution

Replace `.insert_resource(T::default())` calls with `init_resource::<T>()`
@bors bors bot changed the title Replace .insert_resource(T::default()) calls with init_resource::<T>() [Merged by Bors] - Replace .insert_resource(T::default()) calls with init_resource::<T>() Sep 13, 2021
@bors bors bot closed this Sep 13, 2021
@MinerSebas MinerSebas deleted the replace_insert_resource branch October 9, 2021 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-Code-Quality A section of code that is hard to understand or change S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants