Skip to content

Commit 6a27dc4

Browse files
committed
Run cargo fmt with 2024 edition
1 parent 602cddf commit 6a27dc4

File tree

17 files changed

+57
-56
lines changed

17 files changed

+57
-56
lines changed

tarpc/src/client.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ mod in_flight_requests;
1010
pub mod stub;
1111

1212
use crate::{
13-
cancellations::{cancellations, CanceledRequests, RequestCancellation},
13+
ChannelError, ClientMessage, Request, RequestName, Response, ServerError, Transport,
14+
cancellations::{CanceledRequests, RequestCancellation, cancellations},
1415
context, trace,
1516
util::TimeUntil,
16-
ChannelError, ClientMessage, Request, RequestName, Response, ServerError, Transport,
1717
};
1818
use futures::{prelude::*, ready, stream::Fuse, task::*};
1919
use in_flight_requests::InFlightRequests;
@@ -24,8 +24,8 @@ use std::{
2424
fmt,
2525
pin::Pin,
2626
sync::{
27-
atomic::{AtomicUsize, Ordering},
2827
Arc,
28+
atomic::{AtomicUsize, Ordering},
2929
},
3030
time::SystemTime,
3131
};
@@ -679,13 +679,13 @@ struct DispatchRequest<Req, Resp> {
679679
#[cfg(test)]
680680
mod tests {
681681
use super::{
682-
cancellations, Channel, DispatchRequest, RequestDispatch, ResponseGuard, RpcError,
682+
Channel, DispatchRequest, RequestDispatch, ResponseGuard, RpcError, cancellations,
683683
};
684684
use crate::{
685-
client::{in_flight_requests::InFlightRequests, Config},
685+
ChannelError, ClientMessage, Response,
686+
client::{Config, in_flight_requests::InFlightRequests},
686687
context::{self, current},
687688
transport::{self, channel::UnboundedChannel},
688-
ChannelError, ClientMessage, Response,
689689
};
690690
use assert_matches::assert_matches;
691691
use futures::{prelude::*, task::*};
@@ -695,8 +695,8 @@ mod tests {
695695
marker::PhantomData,
696696
pin::Pin,
697697
sync::{
698-
atomic::{AtomicUsize, Ordering},
699698
Arc,
699+
atomic::{AtomicUsize, Ordering},
700700
},
701701
};
702702
use thiserror::Error;

tarpc/src/client/stub.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
//! Provides a Stub trait, implemented by types that can call remote services.
22
33
use crate::{
4+
RequestName,
45
client::{Channel, RpcError},
56
context,
67
server::Serve,
7-
RequestName,
88
};
99

1010
pub mod load_balance;
@@ -25,7 +25,7 @@ pub trait Stub {
2525

2626
/// Calls a remote service.
2727
async fn call(&self, ctx: context::Context, request: Self::Req)
28-
-> Result<Self::Resp, RpcError>;
28+
-> Result<Self::Resp, RpcError>;
2929
}
3030

3131
impl<Req, Resp> Stub for Channel<Req, Resp>

tarpc/src/client/stub/load_balance.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ pub use round_robin::RoundRobin;
66
/// Provides a stub that load-balances with a simple round-robin strategy.
77
mod round_robin {
88
use crate::{
9-
client::{stub, RpcError},
9+
client::{RpcError, stub},
1010
context,
1111
};
1212
use cycle::AtomicCycle;
@@ -48,8 +48,8 @@ mod round_robin {
4848

4949
mod cycle {
5050
use std::sync::{
51-
atomic::{AtomicUsize, Ordering},
5251
Arc,
52+
atomic::{AtomicUsize, Ordering},
5353
};
5454

5555
/// Cycles endlessly and atomically over a collection of elements of type T.
@@ -99,7 +99,7 @@ mod round_robin {
9999
/// the same stub.
100100
mod consistent_hash {
101101
use crate::{
102-
client::{stub, RpcError},
102+
client::{RpcError, stub},
103103
context,
104104
};
105105
use std::{
@@ -176,7 +176,7 @@ mod consistent_hash {
176176
mod tests {
177177
use super::ConsistentHash;
178178
use crate::{
179-
client::stub::{mock::Mock, Stub},
179+
client::stub::{Stub, mock::Mock},
180180
context,
181181
};
182182
use std::{

tarpc/src/client/stub/mock.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use crate::{
2-
client::{stub::Stub, RpcError},
3-
context, RequestName, ServerError,
2+
RequestName, ServerError,
3+
client::{RpcError, stub::Stub},
4+
context,
45
};
56
use std::{collections::HashMap, hash::Hash, io};
67

tarpc/src/client/stub/retry.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
//! Provides a stub that retries requests based on response contents..
22
33
use crate::{
4-
client::{stub, RpcError},
5-
context, RequestName,
4+
RequestName,
5+
client::{RpcError, stub},
6+
context,
67
};
78
use std::sync::Arc;
89

tarpc/src/serde_transport.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use serde::{Deserialize, Serialize};
1414
use std::{error::Error, io, pin::Pin};
1515
use tokio::io::{AsyncRead, AsyncWrite};
1616
use tokio_serde::{Framed as SerdeFramed, *};
17-
use tokio_util::codec::{length_delimited::LengthDelimitedCodec, Framed};
17+
use tokio_util::codec::{Framed, length_delimited::LengthDelimitedCodec};
1818

1919
/// A transport that serializes to, and deserializes from, a byte stream.
2020
#[pin_project]
@@ -42,10 +42,7 @@ where
4242
type Item = io::Result<Item>;
4343

4444
fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<io::Result<Item>>> {
45-
self.project()
46-
.inner
47-
.poll_next(cx)
48-
.map_err(io::Error::other)
45+
self.project().inner.poll_next(cx).map_err(io::Error::other)
4946
}
5047
}
5148

@@ -289,7 +286,7 @@ pub mod unix {
289286
super::*,
290287
futures::ready,
291288
std::{marker::PhantomData, path::Path},
292-
tokio::net::{unix::SocketAddr, UnixListener, UnixStream},
289+
tokio::net::{UnixListener, UnixStream, unix::SocketAddr},
293290
tokio_util::codec::length_delimited,
294291
};
295292

@@ -561,7 +558,7 @@ pub mod unix {
561558
mod tests {
562559
use super::Transport;
563560
use assert_matches::assert_matches;
564-
use futures::{task::*, Sink, Stream};
561+
use futures::{Sink, Stream, task::*};
565562
#[cfg(any(feature = "tcp", all(unix, feature = "unix")))]
566563
use futures::{SinkExt, StreamExt};
567564
use pin_utils::pin_mut;

tarpc/src/server.rs

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
//! Provides a server that concurrently handles many connections sending multiplexed requests.
88
99
use crate::{
10-
cancellations::{cancellations, CanceledRequests, RequestCancellation},
10+
ChannelError, ClientMessage, Request, RequestName, Response, ServerError, Transport,
11+
cancellations::{CanceledRequests, RequestCancellation, cancellations},
1112
context::{self, SpanExt},
1213
trace,
1314
util::TimeUntil,
14-
ChannelError, ClientMessage, Request, RequestName, Response, ServerError, Transport,
1515
};
1616
use ::tokio::sync::mpsc;
1717
use futures::{
@@ -26,7 +26,7 @@ use pin_project::pin_project;
2626
use std::{
2727
convert::TryFrom, error::Error, fmt, marker::PhantomData, pin::Pin, sync::Arc, time::SystemTime,
2828
};
29-
use tracing::{info_span, instrument::Instrument, Span};
29+
use tracing::{Span, info_span, instrument::Instrument};
3030

3131
mod in_flight_requests;
3232
pub mod request_hook;
@@ -955,20 +955,20 @@ where
955955
#[cfg(test)]
956956
mod tests {
957957
use super::{
958+
BaseChannel, Channel, Config, Requests, Serve,
958959
in_flight_requests::AlreadyExistsError,
959960
request_hook::{AfterRequest, BeforeRequest, RequestHook},
960-
serve, BaseChannel, Channel, Config, Requests, Serve,
961+
serve,
961962
};
962963
use crate::{
963-
context, trace,
964+
ClientMessage, Request, Response, ServerError, context, trace,
964965
transport::channel::{self, UnboundedChannel},
965-
ClientMessage, Request, Response, ServerError,
966966
};
967967
use assert_matches::assert_matches;
968968
use futures::{
969-
future::{pending, AbortRegistration, Abortable, Aborted},
970-
prelude::*,
971969
Future,
970+
future::{AbortRegistration, Abortable, Aborted, pending},
971+
prelude::*,
972972
};
973973
use futures_test::task::noop_context;
974974
use std::{
@@ -1321,12 +1321,14 @@ mod tests {
13211321
result => panic!("Unexpected result: {result:?}"),
13221322
};
13231323
request.execute(serve(|_, _| async { Ok(()) })).await;
1324-
assert!(requests
1325-
.as_mut()
1326-
.channel_pin_mut()
1327-
.canceled_requests
1328-
.poll_recv(&mut noop_context())
1329-
.is_pending());
1324+
assert!(
1325+
requests
1326+
.as_mut()
1327+
.channel_pin_mut()
1328+
.canceled_requests
1329+
.poll_recv(&mut noop_context())
1330+
.is_pending()
1331+
);
13301332
}
13311333

13321334
#[tokio::test]

tarpc/src/server/in_flight_requests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ mod tests {
131131

132132
use assert_matches::assert_matches;
133133
use futures::{
134-
future::{pending, Abortable},
135134
FutureExt,
135+
future::{Abortable, pending},
136136
};
137137
use futures_test::task::noop_context;
138138

tarpc/src/server/incoming.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use super::{
2-
limits::{channels_per_key::MaxChannelsPerKey, requests_per_channel::MaxRequestsPerChannel},
32
Channel, RequestName, Serve,
3+
limits::{channels_per_key::MaxChannelsPerKey, requests_per_channel::MaxRequestsPerChannel},
44
};
55
use futures::prelude::*;
66
use std::{fmt, hash::Hash};

tarpc/src/server/limits/requests_per_channel.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
// https://opensource.org/licenses/MIT.
66

77
use crate::{
8-
server::{Channel, Config},
98
Response, ServerError,
9+
server::{Channel, Config},
1010
};
1111
use futures::{prelude::*, ready, task::*};
1212
use pin_project::pin_project;
@@ -179,8 +179,8 @@ mod tests {
179179
use super::*;
180180

181181
use crate::server::{
182-
testing::{self, FakeChannel, PollExt},
183182
TrackedRequest,
183+
testing::{self, FakeChannel, PollExt},
184184
};
185185
use pin_utils::pin_mut;
186186
use std::{
@@ -267,8 +267,8 @@ mod tests {
267267
ghost: PhantomData<fn(Out) -> In>,
268268
}
269269
impl PendingSink<(), ()> {
270-
pub fn default<Req, Resp>(
271-
) -> PendingSink<io::Result<TrackedRequest<Req>>, Response<Resp>> {
270+
pub fn default<Req, Resp>()
271+
-> PendingSink<io::Result<TrackedRequest<Req>>, Response<Resp>> {
272272
PendingSink { ghost: PhantomData }
273273
}
274274
}

0 commit comments

Comments
 (0)