Skip to content

Commit

Permalink
Appease the single_use_lifetimes lint
Browse files Browse the repository at this point in the history
Unfortunately, we can't turn it on because it has false positives that
suggest a code that fails to compile, i.e.
```rust
enum Errors<'err> {
    #[error("An item with the name '{0}' already exists.")]
    ExistingItem(&'err Identifier),
    #[error("A variant referencing '{0}' already exists.")]
    ExistingVariant(&'err Identifier),
    #[error("An expression with the name '{0}' already exists.")]
    ExistingExpression(&'err Identifier),
}
```

suggests to remove the `'err` but it's impossible to define the enum
using the elided lifetime, i.e. `enum Errors<'_>`.

See rust-lang/rust#117965 for the existing bug report.
  • Loading branch information
Xanewok committed Dec 12, 2023
1 parent 68dbcca commit 9245976
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions crates/codegen/parser/runtime/src/support/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,14 @@ pub(crate) struct DelimiterGuard<'a, 's> {
closing_delim: TokenKind,
}

impl<'a, 's> Drop for DelimiterGuard<'a, 's> {
impl Drop for DelimiterGuard<'_, '_> {
fn drop(&mut self) {
let popped = self.input.closing_delimiters.pop();
debug_assert_eq!(popped, Some(self.closing_delim));
}
}

impl<'a, 's> DelimiterGuard<'a, 's> {
impl<'s> DelimiterGuard<'_, 's> {
pub(crate) fn ctx(&mut self) -> &mut ParserContext<'s> {
self.input
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9245976

Please sign in to comment.