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

Invert &Options to Option<&T> #10315

Merged
merged 1 commit into from Sep 12, 2023

Conversation

sholderbach
Copy link
Member

Elide the reference for Copy type (usize)
Use the canonical deref where possible.

  • &Box -> &
  • &String -> &str
  • &PathBuf -> &Path

Skips the ctrl-C handler for now.

@amtoine
Copy link
Member

amtoine commented Sep 11, 2023

Option<&T>

LET'S GO 💪
Choose the Right Option

Elide the reference for `Copy` type (`usize`)
Use the canonical deref where possible.
* `&Box` -> `&`
* `&String` -> `&str`
* `&PathBuf` -> `&Path`

Skips the ctrl-C handler for now.
Copy link
Collaborator

@WindSoilder WindSoilder left a comment

Choose a reason for hiding this comment

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

I never thought about difference between &Option<T> and Option<&T>, but @amtoine 's video convince me that Option<&T> is better :-D

Thanks for the change

@WindSoilder WindSoilder merged commit a14e9e0 into nushell:main Sep 12, 2023
19 checks passed
@sholderbach sholderbach deleted the option-ref-inversion branch September 13, 2023 06:10
hardfau1t pushed a commit to hardfau1t/nushell that referenced this pull request Dec 14, 2023
Elide the reference for `Copy` type (`usize`)
Use the canonical deref where possible.
* `&Box` -> `&`
* `&String` -> `&str`
* `&PathBuf` -> `&Path`

Skips the ctrl-C handler for now.
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.

None yet

3 participants