@@ -8,11 +8,6 @@ use crate::proto::kvrpcpb;
88use crate :: region:: RegionVerId ;
99use crate :: BoundRange ;
1010
11- #[ cfg( clippy) ]
12- type GrpcApiErrorPayload = Box < tonic:: Status > ;
13- #[ cfg( not( clippy) ) ]
14- type GrpcApiErrorPayload = tonic:: Status ;
15-
1611/// Protobuf-generated region-level error returned by TiKV.
1712///
1813/// This type is generated from TiKV's protobuf definitions and may change in a
@@ -73,7 +68,7 @@ pub enum Error {
7368 /// Wraps a `reqwest::Error`.
7469 /// Wraps a `grpcio::Error`.
7570 #[ error( "gRPC api error: {0}" ) ]
76- GrpcAPI ( GrpcApiErrorPayload ) ,
71+ GrpcAPI ( tonic :: Status ) ,
7772 /// Wraps a `grpcio::Error`.
7873 #[ error( "url error: {0}" ) ]
7974 Url ( #[ from] tonic:: codegen:: http:: uri:: InvalidUri ) ,
@@ -149,23 +144,13 @@ impl From<ProtoKeyError> for Error {
149144
150145impl From < tonic:: Status > for Error {
151146 fn from ( status : tonic:: Status ) -> Error {
152- Error :: GrpcAPI ( grpc_api_error_payload ( status) )
147+ Error :: GrpcAPI ( status)
153148 }
154149}
155150
156151/// A result holding an [`Error`](enum@Error).
157152pub type Result < T > = result:: Result < T , Error > ;
158153
159- #[ cfg( clippy) ]
160- fn grpc_api_error_payload ( status : tonic:: Status ) -> GrpcApiErrorPayload {
161- Box :: new ( status)
162- }
163-
164- #[ cfg( not( clippy) ) ]
165- fn grpc_api_error_payload ( status : tonic:: Status ) -> GrpcApiErrorPayload {
166- status
167- }
168-
169154#[ doc( hidden) ]
170155#[ macro_export]
171156macro_rules! internal_err {
@@ -200,7 +185,6 @@ mod test {
200185 }
201186
202187 #[ test]
203- #[ cfg( not( clippy) ) ]
204188 fn grpc_api_variant_accepts_tonic_status_payload ( ) {
205189 let error = Error :: GrpcAPI ( tonic:: Status :: new ( Code :: DeadlineExceeded , "timeout" ) ) ;
206190 let Error :: GrpcAPI ( status) = error else {
0 commit comments