From 20124cb2158ce013e8ddb57578ba96cc31be166b Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Fri, 9 Apr 2021 19:29:29 +0200 Subject: [PATCH] api-macros: Small formatting fixes --- ruma-api-macros/src/api/request.rs | 34 ++++++++++++++++-------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/ruma-api-macros/src/api/request.rs b/ruma-api-macros/src/api/request.rs index 42761c8f..75b80b0a 100644 --- a/ruma-api-macros/src/api/request.rs +++ b/ruma-api-macros/src/api/request.rs @@ -541,7 +541,10 @@ impl Request { self, base_url: &::std::primitive::str, access_token: ::std::option::Option<&str>, - ) -> ::std::result::Result<#http::Request>, #ruma_api::error::IntoHttpError> { + ) -> ::std::result::Result< + #http::Request>, + #ruma_api::error::IntoHttpError, + > { let metadata = self::METADATA; let mut req_builder = #http::Request::builder() @@ -686,20 +689,20 @@ impl Request { let field_name = field.ident.as_ref().expect("expected field to have identifier"); quote!({ - // This function exists so that the compiler will throw an - // error when the type of the field with the query_map - // attribute doesn't implement IntoIterator + // This function exists so that the compiler will throw an error when the type of + // the field with the query_map attribute doesn't implement + // `IntoIterator`. // - // This is necessary because the ruma_serde::urlencoded::to_string - // call will result in a runtime error when the type cannot be - // encoded as a list key-value pairs (?key1=value1&key2=value2) + // This is necessary because the `ruma_serde::urlencoded::to_string` call will + // result in a runtime error when the type cannot be encoded as a list key-value + // pairs (?key1=value1&key2=value2). // - // By asserting that it implements the iterator trait, we can - // ensure that it won't fail. + // By asserting that it implements the iterator trait, we can ensure that it won't + // fail. fn assert_trait_impl(_: &T) where T: ::std::iter::IntoIterator< - Item = (::std::string::String, ::std::string::String) + Item = (::std::string::String, ::std::string::String), >, {} @@ -729,14 +732,13 @@ impl Request { } } - /// The first item in the tuple generates code for the request path from - /// the `Metadata` and `Request` structs. The second item in the returned tuple - /// is the code to generate a Request struct field created from any segments - /// of the path that start with ":". + /// The first item in the tuple generates code for the request path from the `Metadata` and + /// `Request` structs. The second item in the returned tuple is the code to generate a Request + /// struct field created from any segments of the path that start with ":". /// /// The first `TokenStream` returned is the constructed url path. The second `TokenStream` is - /// used for implementing `TryFrom>>`, from path strings deserialized to Ruma - /// types. + /// used for implementing `TryFrom>>`, from path strings deserialized to + /// Ruma types. pub(crate) fn path_string_and_parse( &self, metadata: &Metadata,