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

Add small refactorings #1847

Merged
merged 4 commits into from
Sep 12, 2021
Merged

Add small refactorings #1847

merged 4 commits into from
Sep 12, 2021

Conversation

tranzystorekk
Copy link
Contributor

Summary:

  • Remove some redundant .iter()/.into_iter() calls
  • Reduce nesting in if-else blocks that can be easily short circuited
  • Use deref coercion to avoid some .as_...() calls

@Enselic
Copy link
Collaborator

Enselic commented Sep 10, 2021

Thanks for taking the time to make a contribution!

May I ask if you could please split the change up into smaller commits? The smaller the better, essentially. If there turns out to be a regression, smaller commits will give higher resolution for both git bisect and git revert. They also make code review easier.

I'm also curious if you used clippy to find these, or if you manually found them, if you don't mind me asking?

@tranzystorekk
Copy link
Contributor Author

Hi, thanks for having me! 😄

I'll split the change in a bit.

I'm also curious if you used clippy to find these, or if you manually found them, if you don't mind me asking?

I scanned the code for common idioms manually, e.g. .iter or .as_, I also manually looked through all the if keywords. Sure wish clippy was this smart 😅

src/bin/bat/app.rs Outdated Show resolved Hide resolved
src/assets.rs Outdated Show resolved Hide resolved
@Enselic
Copy link
Collaborator

Enselic commented Sep 11, 2021

I think it looks nice in general! Thanks! Just had two comments on the last commit.

(Please keep doing force-push so I can keep the commits when merging)

Copy link
Collaborator

@Enselic Enselic left a comment

Choose a reason for hiding this comment

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

This looks good to me now. Thanks!

I'll give other maintainers a chance to take a look before I merge.

@Enselic
Copy link
Collaborator

Enselic commented Sep 12, 2021

Thanks for taking a look, Keith. Let's merge this now to not delay #951.

@Enselic Enselic merged commit 863d9ca into sharkdp:master Sep 12, 2021
@tranzystorekk tranzystorekk deleted the refactor-v1 branch September 16, 2021 20:08
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.

3 participants