refactor(lints): add missing lints to service_grpc_influxrpc

Adds the standard lints to service_grpc_influxrpc and fixes any lint
failures.

Note this doesn't include the normal "document things" lint, because
there's a load of missing docs
pull/24376/head
Dom Dwyer 2023-05-22 14:56:45 +02:00
parent 6acf7f10dd
commit b783bb1967
No known key found for this signature in database
GPG Key ID: E4C40DBD9157879A
5 changed files with 23 additions and 6 deletions

View File

@ -456,6 +456,7 @@ impl InListBuilder {
/// Decoded special tag key.
///
/// The storage gRPC layer uses magic special bytes to encode measurement name and field name as tag
#[derive(Debug)]
pub enum DecodedTagKey {
Measurement,
Field,

View File

@ -1,4 +1,18 @@
//! This module contains gRPC service implementation for "InfluxRPC" (aka the storage RPC API used for Flux and InfluxQL)
//! This module contains gRPC service implementation for "InfluxRPC" (aka the
//! storage RPC API used for Flux and InfluxQL)
#![deny(rustdoc::broken_intra_doc_links, rustdoc::bare_urls, rust_2018_idioms)]
#![allow(clippy::clone_on_ref_ptr)]
#![warn(
missing_copy_implementations,
missing_debug_implementations,
clippy::explicit_iter_loop,
// See https://github.com/influxdata/influxdb_iox/pull/1671
clippy::future_not_send,
clippy::clone_on_ref_ptr,
clippy::todo,
clippy::dbg_macro,
)]
/// `[0x00]` is the magic value that that the storage gRPC layer uses to
/// encode a tag_key that means "measurement name"

View File

@ -3,6 +3,7 @@ use pin_project::pin_project;
use tracker::InstrumentedAsyncOwnedSemaphorePermit;
/// Helper to keep a semaphore permit attached to a stream.
#[derive(Debug)]
#[pin_project]
pub struct StreamWithPermit<S> {
#[pin]

View File

@ -7,9 +7,10 @@ use futures::{ready, Stream, StreamExt};
use iox_query::QueryCompletedToken;
/// Wraps an inner query stream, calling the `QueryCompletedToken::set_success` on success
#[derive(Debug)]
pub struct QueryCompletedTokenStream<S, T, E>
where
S: Stream<Item = Result<T, E>> + Unpin,
S: Stream<Item = Result<T, E>> + Unpin + Send,
{
inner: S,
token: QueryCompletedToken,
@ -18,7 +19,7 @@ where
impl<S, T, E> QueryCompletedTokenStream<S, T, E>
where
S: Stream<Item = Result<T, E>> + Unpin,
S: Stream<Item = Result<T, E>> + Unpin + Send,
{
pub fn new(inner: S, token: QueryCompletedToken) -> Self {
Self {
@ -31,7 +32,7 @@ where
impl<S, T, E> Stream for QueryCompletedTokenStream<S, T, E>
where
S: Stream<Item = Result<T, E>> + Unpin,
S: Stream<Item = Result<T, E>> + Unpin + Send,
{
type Item = Result<T, E>;

View File

@ -308,7 +308,7 @@ enum InfluxCode {
}
impl Display for InfluxCode {
fn fmt(&self, f: &mut Formatter) -> FmtResult {
fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
let str = match self {
InfluxCode::EInternal => "internal error",
InfluxCode::ENotFound => "not found",
@ -1705,7 +1705,7 @@ pub fn make_response<S, T, E>(
permit: InstrumentedAsyncOwnedSemaphorePermit,
) -> Result<Response<StreamWithPermit<QueryCompletedTokenStream<S, T, E>>>, Status>
where
S: Stream<Item = Result<T, E>> + Unpin,
S: Stream<Item = Result<T, E>> + Unpin + Send,
{
let mut response = Response::new(StreamWithPermit::new(
QueryCompletedTokenStream::new(stream, token),