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]: using expect instead of unwrap_or_else #911

Closed
lxl66566 opened this issue Jul 22, 2024 · 3 comments
Closed

[refactor]: using expect instead of unwrap_or_else #911

lxl66566 opened this issue Jul 22, 2024 · 3 comments
Assignees
Labels
good first issue Good for newcomers

Comments

@lxl66566
Copy link
Collaborator

currently the code uses a lot of .unwrap_or_else(|| { unreachable!("...") }); / .unwrap_or_else(|| { panic!("...") });. I think it's better to use exepct because it's more intuitive, and using less code.

Things to do:

  1. allow expect in clippy global rule
  2. replace code
@lxl66566 lxl66566 added the good first issue Good for newcomers label Jul 22, 2024
Copy link

👋 Thanks for opening this issue!

Reply with the following command on its own line to get help or engage:

  • /contributing-agreement : to print Contributing Agreements.
  • /assignme : to assign this issue to you.

@bsbds
Copy link
Collaborator

bsbds commented Jul 23, 2024

We could also consider replacing

let Some(x) = y else {
    unreachable!("...");
};

with

let x  = y.expect("...");

@LucienY01
Copy link
Collaborator

/assignme

@LucienY01 LucienY01 closed this as not planned Won't fix, can't repro, duplicate, stale Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants