Skip to content

Conversation

samueltardieu
Copy link
Member

By default, do not lint .unwrap() and .expect(…) in always const contexts, as a failure would be detected at compile time anyway.

New options allow_expect_in_consts and allow_unwrap_in_consts, defaulting to true, can be turned unset to still lint in always const contexts.

Close #14198

changelog: [unwrap_used, expect_used]: add new option to lint in always constant contexts

By default, do not lint `.unwrap()` and `.expect(…)` in always const
contexts, as a failure would be detected at compile time anyway.

New options `allow_expect_in_consts` and `allow_unwrap_in_consts`,
defaulting to `true`, can be turned unset to still lint in always const
contexts.
@rustbot
Copy link
Collaborator

rustbot commented Feb 11, 2025

r? @llogiq

rustbot has assigned @llogiq.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Feb 11, 2025
@llogiq
Copy link
Contributor

llogiq commented Feb 12, 2025

Thank you!

@llogiq llogiq added this pull request to the merge queue Feb 12, 2025
Merged via the queue into rust-lang:master with commit 32aef11 Feb 12, 2025
11 checks passed
@samueltardieu samueltardieu deleted the push-olvmkwvsqrsu branch February 12, 2025 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allowing clippy::unwrap_used in const contexts
3 participants