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

Remove uses of #[allow(dead_code) in favor of names starting with _ #13278

Closed
alamb opened this issue Nov 6, 2024 · 1 comment · Fixed by #13328
Closed

Remove uses of #[allow(dead_code) in favor of names starting with _ #13278

alamb opened this issue Nov 6, 2024 · 1 comment · Fixed by #13328
Assignees
Labels
good first issue Good for newcomers

Comments

@alamb
Copy link
Contributor

alamb commented Nov 6, 2024

TLDR is that we have some code (such as referenced below) that uses #[allow(dead_code)] to permit a field that is only present so its Drop (destructor) can run.

          Apparently this can be also written without disabling a lint:
    _reservation: MemoryReservation,
  • #[allow(dead_code)] has disadvantage that it can be retained in the code even if the field becomes used
  • _reservation has disadvantage that it doesn't look pretty

Originally posted by @findepi in #13227 (comment)

@drauschenbach notes: #13227 (comment)

Pretty or not, _reservation is the language-appropriate idiom.

Thus it would be great to update the code to use _reservation in the case above, and potentially look in the codebase for other similar uses of #[allow(dead_code)] and use the _ prefix

@ding-young
Copy link
Contributor

take

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

Successfully merging a pull request may close this issue.

2 participants