diff --git a/README.md b/README.md index 94eec74..dcc7352 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ returns the value produced by the other process. RPC frameworks are a fundamental building block of most microservices-oriented architectures. Two well-known ones are [gRPC](http://www.grpc.io) and -[Cap’n Proto](https://capnproto.org/). +[Cap'n Proto](https://capnproto.org/). tarpc differentiates itself from other RPC frameworks by defining the schema in code, rather than in a separate language such as .proto. This means there's no separate compilation @@ -128,7 +128,7 @@ impl World for HelloServer { type HelloFut = Ready; fn hello(self, _: context::Context, name: String) -> Self::HelloFut { - future::ready(format!("Hello, {}!", name)) + future::ready(format!("Hello, {name}!")) } } ``` @@ -155,7 +155,7 @@ async fn main() -> anyhow::Result<()> { // specifies a deadline and trace information which can be helpful in debugging requests. let hello = client.hello(context::current(), "Stim".to_string()).await?; - println!("{}", hello); + println!("{hello}"); Ok(()) } diff --git a/example-service/src/server.rs b/example-service/src/server.rs index f74fb31..bc2f6a6 100644 --- a/example-service/src/server.rs +++ b/example-service/src/server.rs @@ -40,7 +40,7 @@ impl World for HelloServer { let sleep_time = Duration::from_millis(Uniform::new_inclusive(1, 10).sample(&mut thread_rng())); time::sleep(sleep_time).await; - format!("Hello, {}! You are connected from {}", name, self.0) + format!("Hello, {name}! You are connected from {}", self.0) } } diff --git a/plugins/src/lib.rs b/plugins/src/lib.rs index 233a65d..aa84c4f 100644 --- a/plugins/src/lib.rs +++ b/plugins/src/lib.rs @@ -83,7 +83,7 @@ impl Parse for Service { ident_errors, syn::Error::new( rpc.ident.span(), - format!("method name conflicts with generated fn `{}::serve`", ident) + format!("method name conflicts with generated fn `{ident}::serve`") ) ); } @@ -270,7 +270,7 @@ pub fn service(attr: TokenStream, input: TokenStream) -> TokenStream { let methods = rpcs.iter().map(|rpc| &rpc.ident).collect::>(); let request_names = methods .iter() - .map(|m| format!("{}.{}", ident, m)) + .map(|m| format!("{ident}.{m}")) .collect::>(); ServiceGenerator { @@ -306,7 +306,7 @@ pub fn service(attr: TokenStream, input: TokenStream) -> TokenStream { .collect::>(), future_types: &camel_case_fn_names .iter() - .map(|name| parse_str(&format!("{}Fut", name)).unwrap()) + .map(|name| parse_str(&format!("{name}Fut")).unwrap()) .collect::>(), derive_serialize: derive_serialize.as_ref(), } @@ -409,7 +409,7 @@ fn verify_types_were_provided( if !provided.iter().any(|typedecl| typedecl.ident == expected) { let mut e = syn::Error::new( span, - format!("not all trait items implemented, missing: `{}`", expected), + format!("not all trait items implemented, missing: `{expected}`"), ); let fn_span = method.sig.fn_token.span(); e.extend(syn::Error::new( @@ -479,7 +479,7 @@ impl<'a> ServiceGenerator<'a> { ), output, )| { - let ty_doc = format!("The response future returned by [`{}::{}`].", service_ident, ident); + let ty_doc = format!("The response future returned by [`{service_ident}::{ident}`]."); quote! { #[doc = #ty_doc] type #future_type: std::future::Future; diff --git a/tarpc/examples/compression.rs b/tarpc/examples/compression.rs index ccd73af..942fdc8 100644 --- a/tarpc/examples/compression.rs +++ b/tarpc/examples/compression.rs @@ -54,7 +54,7 @@ where if algorithm != CompressionAlgorithm::Deflate { return Err(io::Error::new( io::ErrorKind::InvalidData, - format!("Compression algorithm {:?} not supported", algorithm), + format!("Compression algorithm {algorithm:?} not supported"), )); } let mut deflater = DeflateDecoder::new(payload.as_slice()); @@ -102,7 +102,7 @@ struct HelloServer; #[tarpc::server] impl World for HelloServer { async fn hello(self, _: context::Context, name: String) -> String { - format!("Hey, {}!", name) + format!("Hey, {name}!") } } diff --git a/tarpc/examples/readme.rs b/tarpc/examples/readme.rs index b548ddf..8079231 100644 --- a/tarpc/examples/readme.rs +++ b/tarpc/examples/readme.rs @@ -29,7 +29,7 @@ impl World for HelloServer { type HelloFut = Ready; fn hello(self, _: context::Context, name: String) -> Self::HelloFut { - future::ready(format!("Hello, {}!", name)) + future::ready(format!("Hello, {name}!")) } } @@ -49,7 +49,7 @@ async fn main() -> anyhow::Result<()> { // specifies a deadline and trace information which can be helpful in debugging requests. let hello = client.hello(context::current(), "Stim".to_string()).await?; - println!("{}", hello); + println!("{hello}"); Ok(()) } diff --git a/tarpc/src/lib.rs b/tarpc/src/lib.rs index 7c04b52..e04f9fa 100644 --- a/tarpc/src/lib.rs +++ b/tarpc/src/lib.rs @@ -132,7 +132,7 @@ //! type HelloFut = Ready; //! //! fn hello(self, _: context::Context, name: String) -> Self::HelloFut { -//! future::ready(format!("Hello, {}!", name)) +//! future::ready(format!("Hello, {name}!")) //! } //! } //! ``` @@ -168,7 +168,7 @@ //! # // an associated type representing the future output by the fn. //! # type HelloFut = Ready; //! # fn hello(self, _: context::Context, name: String) -> Self::HelloFut { -//! # future::ready(format!("Hello, {}!", name)) +//! # future::ready(format!("Hello, {name}!")) //! # } //! # } //! # #[cfg(not(feature = "tokio1"))] @@ -190,7 +190,7 @@ //! // specifies a deadline and trace information which can be helpful in debugging requests. //! let hello = client.hello(context::current(), "Stim".to_string()).await?; //! -//! println!("{}", hello); +//! println!("{hello}"); //! //! Ok(()) //! } @@ -264,7 +264,7 @@ pub use tarpc_plugins::service; /// #[tarpc::server] /// impl World for HelloServer { /// async fn hello(self, _: context::Context, name: String) -> String { -/// format!("Hello, {}! You are connected from {:?}.", name, self.0) +/// format!("Hello, {name}! You are connected from {:?}.", self.0) /// } /// } /// ``` @@ -290,7 +290,7 @@ pub use tarpc_plugins::service; /// fn hello(self, _: context::Context, name: String) -> Pin /// + Send>> { /// Box::pin(async move { -/// format!("Hello, {}! You are connected from {:?}.", name, self.0) +/// format!("Hello, {name}! You are connected from {:?}.", self.0) /// }) /// } /// } diff --git a/tarpc/src/transport/channel.rs b/tarpc/src/transport/channel.rs index c39ed93..529ae8f 100644 --- a/tarpc/src/transport/channel.rs +++ b/tarpc/src/transport/channel.rs @@ -181,7 +181,7 @@ mod tests { future::ready(request.parse::().map_err(|_| { io::Error::new( io::ErrorKind::InvalidInput, - format!("{:?} is not an int", request), + format!("{request:?} is not an int"), ) })) }), diff --git a/tarpc/src/util.rs b/tarpc/src/util.rs index aeeb164..ad04236 100644 --- a/tarpc/src/util.rs +++ b/tarpc/src/util.rs @@ -51,7 +51,7 @@ fn test_compact() { // Make usage ratio 25% for i in 0..896 { - map.insert(format!("k{}", i), "v"); + map.insert(format!("k{i}"), "v"); } map.compact(-1.0); diff --git a/tarpc/tests/compile_fail/tarpc_server_missing_async.rs b/tarpc/tests/compile_fail/tarpc_server_missing_async.rs index 5b7ee1e..99d858b 100644 --- a/tarpc/tests/compile_fail/tarpc_server_missing_async.rs +++ b/tarpc/tests/compile_fail/tarpc_server_missing_async.rs @@ -7,8 +7,8 @@ struct HelloServer; #[tarpc::server] impl World for HelloServer { - fn hello(name: String) -> String { - format!("Hello, {}!", name) + fn hello(name: String) -> String { + format!("Hello, {name}!", name) } } diff --git a/tarpc/tests/compile_fail/tarpc_server_missing_async.stderr b/tarpc/tests/compile_fail/tarpc_server_missing_async.stderr index 318e420..28106e6 100644 --- a/tarpc/tests/compile_fail/tarpc_server_missing_async.stderr +++ b/tarpc/tests/compile_fail/tarpc_server_missing_async.stderr @@ -7,5 +7,5 @@ error: not all trait items implemented, missing: `HelloFut` error: hint: `#[tarpc::server]` only rewrites async fns, and `fn hello` is not async --> $DIR/tarpc_server_missing_async.rs:10:5 | -10 | fn hello(name: String) -> String { +10 | fn hello(name: String) -> String { | ^^ diff --git a/tarpc/tests/service_functional.rs b/tarpc/tests/service_functional.rs index b1aa431..a4939ee 100644 --- a/tarpc/tests/service_functional.rs +++ b/tarpc/tests/service_functional.rs @@ -31,7 +31,7 @@ impl Service for Server { type HeyFut = Ready; fn hey(self, _: context::Context, name: String) -> Self::HeyFut { - ready(format!("Hey, {}.", name)) + ready(format!("Hey, {name}.")) } }