chore: Apply clippy (#189)

This commit is contained in:
Lucio Franco
2019-12-13 23:55:49 -05:00
committed by GitHub
parent 502491a590
commit 82facb6283
8 changed files with 19 additions and 19 deletions
+1 -1
View File
@@ -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))
}
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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))
}
+6 -6
View File
@@ -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,
}),
};
@@ -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);
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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))
}