Skip to content

fix: Replace suffix before converting to snake case #564

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

Merged
merged 1 commit into from
Jan 13, 2022

Conversation

duskmoon314
Copy link
Contributor

Abstract

In #563, we noticed that converting fields' names to snake cases before replacing the suffix caused the generated methods not to satisfy the snake case. This PR fixes this issue.

Change

Use util::replace_suffix(&f.name, suffix).to_sanitized_snake_case() instead of util::replace_suffix(&f.name.to_sanitized_snake_case(), suffix) when generating methods of fields.

@duskmoon314 duskmoon314 requested a review from a team as a code owner January 12, 2022 16:21
@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Emilgardis (or someone else) soon.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-tools labels Jan 12, 2022
Copy link
Member

@adamgreig adamgreig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thank you!

The CI failure on nightly isn't an issue for this.

bors merge

bors bot added a commit that referenced this pull request Jan 13, 2022
564: fix: Replace suffix before converting to snake case r=adamgreig a=duskmoon314

## Abstract

In #563, we noticed that converting fields' names to snake cases before replacing the suffix caused the generated methods not to satisfy the snake case. This PR fixes this issue.

## Change

Use `util::replace_suffix(&f.name, suffix).to_sanitized_snake_case()` instead of `util::replace_suffix(&f.name.to_sanitized_snake_case(), suffix)` when generating methods of fields.

Co-authored-by: Campbell He <campbell.he@icloud.com>
@bors
Copy link
Contributor

bors bot commented Jan 13, 2022

Build failed:

@adamgreig
Copy link
Member

Oh, boo, since we aggregated all the CI jobs into one "CI", bors requires the nightly tests to pass as well, that's unfortunate. This needs esp-rs/xtensa-lx#14 to be merged and published, but I guess that might not be until after Rust 1.59.

I'll open a PR to disable the Espressif CI in the meantime.

bors bot added a commit that referenced this pull request Jan 13, 2022
565: Temporarily disable Espressif in CI until fixed upstream r=burrbull a=adamgreig

See esp-rs/xtensa-lx#14 and #564 (comment)

Co-authored-by: Adam Greig <adam@adamgreig.com>
@burrbull
Copy link
Member

bors retry

@bors
Copy link
Contributor

bors bot commented Jan 13, 2022

Build succeeded:

@bors bors bot merged commit 59ae59c into rust-embedded:master Jan 13, 2022
@duskmoon314 duskmoon314 deleted the snake_after_replace branch January 14, 2022 08:52
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. T-tools
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants