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

Refactor and shorten component creation #1370

Closed
wants to merge 1 commit into from

Conversation

alexmaco
Copy link
Contributor

@alexmaco alexmaco commented Oct 3, 2022

It changes the following:

  • groups common items for components initialization in an Environment to reduce some repetition

I followed the checklist:

  • I added unittests
  • I ran make check without errors
  • I tested the overall application
  • I added an appropriate item to the changelog

@extrawurst
Copy link
Owner

I like the idea. I would like to move forward with this. please rebase again and resolve the merge conflicts!

@alexmaco
Copy link
Contributor Author

@extrawurst perhaps another look at this?

@@ -35,28 +35,18 @@ impl ChangesComponent {
//TODO: fix
#[allow(clippy::too_many_arguments)]
Copy link
Owner

Choose a reason for hiding this comment

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

is this fixed by the change? can it be removed?

key_config: SharedKeyConfig,
options: SharedOptions,
) -> Self {
pub fn new(env: &crate::app::Environment) -> Self {
Copy link
Owner

Choose a reason for hiding this comment

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

so far the other places import this instead of fully-qualifying. lets stay consistent


/// The need to construct a "whatever" environment only arises in testing right now
#[cfg(test)]
impl Default for Environment {
Copy link
Owner

Choose a reason for hiding this comment

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

does it need to be the Default trait though? lets make it explicit and just make it a static fn new_test_env

theme: Default::default(),
key_config: Default::default(),
repo: RefCell::new(RepoPath::Path(Default::default())),
options: Default::default(),
Copy link
Owner

Choose a reason for hiding this comment

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

same for Options::default

@@ -32,6 +32,17 @@ pub struct Options {
data: OptionsData,
}

#[cfg(test)]
impl Default for Options {
Copy link
Owner

Choose a reason for hiding this comment

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

see above

Copy link
Owner

@extrawurst extrawurst left a comment

Choose a reason for hiding this comment

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

obviously just nitpick. good work! sorry for the delay

@extrawurst
Copy link
Owner

@alexmaco are you still on this?

@extrawurst
Copy link
Owner

made these cleanups myself now and will merge as part of #2043

@extrawurst extrawurst closed this Feb 12, 2024
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