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

chore: fix argument type in bytes method call in build.rs #368

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

0xlora
Copy link

@0xlora 0xlora commented Jan 18, 2025

The bytes method was being called with an array of strings [&str; N], but it actually expects a slice of strings &[&str]. I've fixed this by adding a & before the array.
This ensures the correct type is passed and avoids any potential issues.

fn main() -> Result<()> {
// Proto compilation rules for `simplex` dialect
let mut config = prost_build::Config::new();
config.bytes([
config.bytes(&[
Copy link
Contributor

Choose a reason for hiding this comment

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

While this isn't a fix per se (it works fine), their examples do definitely use & and find it worth mirroring their style: https://docs.rs/prost-build/latest/prost_build/struct.Config.html#method.bytes

Would you mind making this change to all build.rs files (I'd like to do all at once).

@0xlora 0xlora requested a review from patrick-ogrady January 18, 2025 17:30
@patrick-ogrady
Copy link
Contributor

Would you mind rebasing this?

@0xlora
Copy link
Author

0xlora commented Jan 30, 2025

Would you mind rebasing this?

Thank you for the feedback! I completely agree that it’s worth mirroring the style used in the official examples for consistency. I’ll update the PR to apply this change across all build.rs files to ensure uniformity.

I’ll make the adjustments and push the changes shortly. Let me know if there’s anything else you’d like me to address!

@0xlora
Copy link
Author

0xlora commented Feb 1, 2025

patrick-ogrady please check and merge.

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.

2 participants