hyperium / tonic

A native gRPC client & server implementation with async/await support.
https://docs.rs/tonic
MIT License
10.02k stars 1.02k forks source link

build warnings in generated protobuf code (pt2) #1008

Closed bmulder-innoseis closed 2 years ago

bmulder-innoseis commented 2 years ago

Version: 0.7.2

see #295, but this also happens in streaming calls.

proto:

service Foo {
    rpc bar (barRequest) returns (stream barResponse);
}

generated server code:

pub mod foo_server {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
    use tonic::codegen::*;
    ///Generated trait containing gRPC methods that should be implemented for use with FooServer.
    #[async_trait]
    pub trait Foo: Send + Sync + 'static {
        ///Server streaming response type for the bar method.
        type barStream: futures_core::Stream<
                Item = Result<super::BarResponse, tonic::Status>,
            >
            + Send
            + 'static;
        [...]
    }
}

when compiling:

    |
135 |         type barStream: futures_core::Stream<
    |              ^^^^^^^^^^^^^^^^^ help: convert the identifier to upper camel case: `BarStream`
    |
    = note: `#[warn(non_camel_case_types)]` on by default

Originally posted by @bmulder-innoseis in https://github.com/hyperium/tonic/issues/295#issuecomment-1141864710

LucioFranco commented 2 years ago

I want to say that protobuf style is to use camel case for messages but you can just add the warning allow attribute to the module you include the proto in and it will ignore the error.

bmulder-innoseis commented 2 years ago

I want to say that protobuf style is to use camel case for messages

You are right, my mistake. This can be closed.