Skip to content

Apply the C-EVOCATIVE guideline to options! #2480

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
Apr 4, 2023

Conversation

pvdrz
Copy link
Contributor

@pvdrz pvdrz commented Apr 4, 2023

The Rust API Guidelines state that macors should keep the input syntax of a macro similar to the Rust syntax when possible.

The options! macro input followed this format:

field: {
    ty: Ty,
    ...
}

However, the following syntax should be better:

field: ty {
    ...
}

This is done because the options! macro defines a struct and these changes still evoke the common field: ty syntax followed by Rust.

See
https://rust-lang.github.io/api-guidelines/macros.html#input-syntax-is-evocative-of-the-output-c-evocative.

The Rust API Guidelines state that macors should keep the input syntax
of a macro similar to the Rust syntax when possible.

The `options!` macro input followed this format:
```rust
field: {
    ty: Ty,
    ...
}
```
However, the following syntax should be better:
```rust
field: ty {
    ...
}
```
This is done because the `options!` macro defines a `struct` and these
changes still evoke the common `field: ty` syntax followed by Rust.

See
https://rust-lang.github.io/api-guidelines/macros.html#input-syntax-is-evocative-of-the-output-c-evocative.
@pvdrz pvdrz merged commit 0f1a404 into rust-lang:main Apr 4, 2023
@pvdrz pvdrz deleted the c-evocative-for-options branch April 4, 2023 02:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant