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

"Generate getter" assist unnecessarily uses .as_ref() when deref coercion would work #12389

Closed
jonas-schievink opened this issue May 25, 2022 · 0 comments · Fixed by #16487
Closed
Labels
A-assists C-feature Category: feature request S-actionable Someone could pick this issue up and work on it right now

Comments

@jonas-schievink
Copy link
Contributor

struct S {
    v$0: Vec<u8>,
}

Generates:

impl S {
    fn v(&self) -> &[u8] {
        self.v.as_ref()
    }
}

It would probably be better if the body of v was just &self.v instead of going through .as_ref().

@jonas-schievink jonas-schievink added S-actionable Someone could pick this issue up and work on it right now A-assists labels May 25, 2022
@flodiebold flodiebold added the C-feature Category: feature request label Jun 17, 2022
@bors bors closed this as completed in e071834 Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-assists C-feature Category: feature request S-actionable Someone could pick this issue up and work on it right now
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants