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

[tech] move the enhance co2 function out of the model #738

Merged
merged 3 commits into from
Feb 3, 2021

Conversation

antoine-de
Copy link
Contributor

This is the first step to split model.rs into several files to improve maintanability.

To ease review I think you can review this and if it's ok we can merge and do separate PR

This is the first step to split `model.rs` into several files to improve
maintanability.
@antoine-de antoine-de changed the title move the enhance co2 function out of the model [tech] move the enhance co2 function out of the model Jan 29, 2021
@antoine-de antoine-de requested a review from woshilapin January 29, 2021 16:08
woshilapin
woshilapin previously approved these changes Feb 1, 2021

/// Physical mode should contains CO2 emissions. If the values are not present
/// in the NTFS, some default values will be used.
pub fn enhance_with_co2(collections: &mut Collections) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm never sure which is better between

pub fn enhance_with_co2(collections: &mut Collections) { ... }

and

pub fn enhance_with_co2(collections: Collections) -> Collections { ... }

The benefit of the second version is that the function is pure.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure but I wanted to have minimal changes and I'm not really convinced one is really better than the other 🤔

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And you were probably right to do minimal changes at this point. I guess I took the opportunity to review it since the code was changed. Anyone else has an opinion on the topic?

pbougue
pbougue previously approved these changes Feb 1, 2021
Copy link
Contributor

@pbougue pbougue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks OK, although I think @woshilapin and @datanel should have a look at the new storage.
Detail (if I'm not mistaken): The order in which enhancements/cleanups are applied matters for performance and functionnality, so we have to pay attention to have this readable and accessible I guess. Maybe just pay attention to enhancers' rust-comments is doing most of the job.

woshilapin
woshilapin previously approved these changes Feb 2, 2021
ArnaudOggy
ArnaudOggy previously approved these changes Feb 2, 2021
woshilapin
woshilapin previously approved these changes Feb 2, 2021
ArnaudOggy
ArnaudOggy previously approved these changes Feb 2, 2021
pbougue
pbougue previously approved these changes Feb 2, 2021
@woshilapin
Copy link
Contributor

You need to bump the Cargo.toml to 0.33.2 by the way since 0.33.1 has been released.

@antoine-de antoine-de dismissed stale reviews from pbougue, ArnaudOggy, and woshilapin via e3e696f February 2, 2021 16:58
@datanel datanel self-requested a review February 3, 2021 09:51
@datanel datanel merged commit 52250ed into hove-io:master Feb 3, 2021
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.

5 participants