tokio-rs / prost

PROST! a Protocol Buffers implementation for the Rust Language
Apache License 2.0
3.92k stars 504 forks source link

Deriving Message gives warning about snake_case #885

Open jhseu opened 1 year ago

jhseu commented 1 year ago

This can be seen with rust-analyzer in prost/tests/message_encoding.rs, which gives 47 warnings of:

Function ScalarWrapper should have snake_case name, e.g. scalar_wrapper

It seems to be a new issue, since I didn't see it a few weeks ago.

spencerwilson commented 1 year ago

In my project that uses tonic::include_proto!, the rust-analyzer bundled with the rust-analyzer VS Code extension (rust-analyzer 0.3.1607-standalone (429a3816a 2023-07-30)) is emitting 23 occurrences of this same error. What tripped me up is that cargo check is not emitting warnings, and I expected the two tools to always agree when it comes to reporting rustc-based lints like non_snake_case.

Although rust-analyzer is picking up on some code generated by prost-derive - https://github.com/tokio-rs/prost/blob/468c80cd343321d5d4b361febbeec832ab5228b6/prost-derive/src/field/mod.rs#L145-L153 - that code hasn't been touched in a year, and also the appearance of the warnings for me wasn't precipitated by a change in the version of prost-derive or anything else nearby, so my money's on this being due to a rust-analyzer change.

Haven't yet tried other rust-analyzer releases to test that hypothesis.

spencerwilson commented 1 year ago

Ok yeah, narrowed it down to two consecutive releases:

% /Users/spencer/Downloads/rust-analyzer-aarch64-apple-darwin-ok --version
rust-analyzer 0.3.1591-standalone (d82451103 2023-07-16)
% /Users/spencer/Downloads/rust-analyzer-aarch64-apple-darwin-bad --version
rust-analyzer 0.3.1599-standalone (99718d0c8 2023-07-22)
spencerwilson commented 1 year ago

See https://github.com/rust-lang/rust-analyzer/issues/15394

LucioFranco commented 1 year ago

This seems like its been fixed?