Skip to content

Commit

Permalink
chore: Apply clippy (#189)
Browse files Browse the repository at this point in the history
  • Loading branch information
LucioFranco authored Dec 14, 2019
1 parent 502491a commit 82facb6
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion examples/src/helloworld/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ impl Greeter for MyGreeter {
println!("Got a request from {:?}", request.remote_addr());

let reply = hello_world::HelloReply {
message: format!("Hello {}!", request.into_inner().name).into(),
message: format!("Hello {}!", request.into_inner().name),
};
Ok(Response::new(reply))
}
Expand Down
2 changes: 1 addition & 1 deletion examples/src/load_balance/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use tonic::transport::Channel;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let endpoints = ["http://[::1]:50051", "http://[::1]:50052"]
.into_iter()
.iter()
.map(|a| Channel::from_static(a));

let channel = Channel::balance_list(endpoints);
Expand Down
2 changes: 1 addition & 1 deletion examples/src/multiplex/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl Greeter for MyGreeter {
request: Request<HelloRequest>,
) -> Result<Response<HelloReply>, Status> {
let reply = hello_world::HelloReply {
message: format!("Hello {}!", request.into_inner().name).into(),
message: format!("Hello {}!", request.into_inner().name),
};
Ok(Response::new(reply))
}
Expand Down
12 changes: 6 additions & 6 deletions examples/src/routeguide/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ use route_guide::routeguide_client::RouteGuideClient;
async fn print_features(client: &mut RouteGuideClient<Channel>) -> Result<(), Box<dyn Error>> {
let rectangle = Rectangle {
lo: Some(Point {
latitude: 400000000,
longitude: -750000000,
latitude: 400_000_000,
longitude: -750_000_000,
}),
hi: Some(Point {
latitude: 420000000,
longitude: -730000000,
latitude: 420_000_000,
longitude: -730_000_000,
}),
};

Expand Down Expand Up @@ -96,8 +96,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
println!("*** SIMPLE RPC ***");
let response = client
.get_feature(Request::new(Point {
latitude: 409146138,
longitude: -746188906,
latitude: 409_146_138,
longitude: -746_188_906,
}))
.await?;
println!("RESPONSE = {:?}", response);
Expand Down
2 changes: 1 addition & 1 deletion examples/src/routeguide/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ fn in_range(point: &Point, rect: &Rectangle) -> bool {
/// This code was taken from http://www.movable-type.co.uk/scripts/latlong.html.
fn calc_distance(p1: &Point, p2: &Point) -> i32 {
const CORD_FACTOR: f64 = 1e7;
const R: f64 = 6371000.0; // meters
const R: f64 = 6_371_000.0; // meters

let lat1 = p1.latitude as f64 / CORD_FACTOR;
let lat2 = p2.latitude as f64 / CORD_FACTOR;
Expand Down
2 changes: 1 addition & 1 deletion examples/src/tracing/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ impl Greeter for MyGreeter {
tracing::info!(message = "Inbound request.", metadata = ?request.metadata());

let reply = hello_world::HelloReply {
message: format!("Hello {}!", request.into_inner().name).into(),
message: format!("Hello {}!", request.into_inner().name),
};

tracing::debug!(message = "Sending reply.", response = %reply.message);
Expand Down
2 changes: 1 addition & 1 deletion examples/src/uds/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ impl Greeter for MyGreeter {
println!("Got a request: {:?}", request);

let reply = hello_world::HelloReply {
message: format!("Hello {}!", request.into_inner().name).into(),
message: format!("Hello {}!", request.into_inner().name),
};
Ok(Response::new(reply))
}
Expand Down
14 changes: 7 additions & 7 deletions interop/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ use tonic::{metadata::MetadataValue, Code, Request, Response, Status};
pub type TestClient = TestServiceClient<Channel>;
pub type UnimplementedClient = UnimplementedServiceClient<Channel>;

const LARGE_REQ_SIZE: usize = 271828;
const LARGE_RSP_SIZE: i32 = 314159;
const REQUEST_LENGTHS: &'static [i32] = &[27182, 8, 1828, 45904];
const RESPONSE_LENGTHS: &'static [i32] = &[31415, 9, 2653, 58979];
const TEST_STATUS_MESSAGE: &'static str = "test status message";
const SPECIAL_TEST_STATUS_MESSAGE: &'static str =
const LARGE_REQ_SIZE: usize = 271_828;
const LARGE_RSP_SIZE: i32 = 314_159;
const REQUEST_LENGTHS: &[i32] = &[27182, 8, 1828, 45904];
const RESPONSE_LENGTHS: &[i32] = &[31415, 9, 2653, 58979];
const TEST_STATUS_MESSAGE: &str = "test status message";
const SPECIAL_TEST_STATUS_MESSAGE: &str =
"\t\ntest with whitespace\r\nand Unicode BMP ☺ and non-BMP 😈\t\n";

pub async fn empty_unary(client: &mut TestClient, assertions: &mut Vec<TestAssertion>) {
Expand Down Expand Up @@ -217,7 +217,7 @@ pub async fn empty_stream(client: &mut TestClient, assertions: &mut Vec<TestAsse

assertions.push(test_assert!(
"there should be no responses",
responses.len() == 0,
responses.is_empty(),
format!("responses.len()={:?}", responses.len())
));
}
Expand Down

0 comments on commit 82facb6

Please sign in to comment.