Qualify more paths in macro-generated code

This commit is contained in:
Jonas Platte 2021-04-13 21:50:01 +02:00
parent f6371bb1f2
commit e4ae2a40ee
No known key found for this signature in database
GPG Key ID: CC154DE0E30B7C67
4 changed files with 12 additions and 11 deletions

View File

@ -222,7 +222,7 @@ impl Request {
const METADATA: #ruma_api::Metadata = self::METADATA;
fn try_from_http_request<T: #bytes::Buf>(
fn try_from_http_request<T: ::std::convert::AsRef<[::std::primitive::u8]>>(
request: #http::Request<T>
) -> ::std::result::Result<Self, #ruma_api::error::FromHttpRequestError> {
if request.method() != #http::Method::#method {
@ -239,7 +239,7 @@ impl Request {
#extract_body
#parse_body
Ok(Self {
::std::result::Result::Ok(Self {
#path_vars
#query_vars
#header_vars

View File

@ -200,9 +200,9 @@ impl Request {
fn try_into_http_request(
self,
base_url: &::std::primitive::str,
access_token: ::std::option::Option<&str>,
access_token: ::std::option::Option<&::std::primitive::str>,
) -> ::std::result::Result<
#http::Request<Vec<u8>>,
#http::Request<::std::vec::Vec<::std::primitive::u8>>,
#ruma_api::error::IntoHttpError,
> {
let metadata = self::METADATA;

View File

@ -75,7 +75,7 @@ impl Response {
fn try_into_http_response(
self,
) -> ::std::result::Result<
#http::Response<::std::vec::Vec<u8>>,
#http::Response<::std::vec::Vec<::std::primitive::u8>>,
#ruma_api::error::IntoHttpError,
> {
let mut resp_builder = #http::Response::builder()
@ -88,7 +88,7 @@ impl Response {
// This cannot fail because we parse each header value checking for errors as
// each value is inserted and we only allow keys from the `http::header` module.
Ok(resp_builder.body(#body).unwrap())
::std::result::Result::Ok(resp_builder.body(#body).unwrap())
}
}
}

View File

@ -408,19 +408,20 @@ fn expand_content_enum(
}
fn from_parts(
event_type: &str, input: Box<#serde_json::value::RawValue>,
) -> Result<Self, #serde_json::Error> {
event_type: &::std::primitive::str,
input: ::std::boxed::Box<#serde_json::value::RawValue>,
) -> ::std::result::Result<Self, #serde_json::Error> {
match event_type {
#(
#variant_attrs #event_type_str => {
let content = #content::from_parts(event_type, input)?;
Ok(#variant_ctors(content))
::std::result::Result::Ok(#variant_ctors(content))
},
)*
ev_type => {
let content =
#ruma_events::custom::CustomEventContent::from_parts(ev_type, input)?;
Ok(Self::Custom(content))
::std::result::Result::Ok(Self::Custom(content))
},
}
}
@ -713,7 +714,7 @@ fn accessor_methods(
let event_type = quote! {
/// Returns the `type` of this event.
pub fn event_type(&self) -> &str {
pub fn event_type(&self) -> &::std::primitive::str {
match self {
#( #self_variants(event) =>
#ruma_events::EventContent::event_type(&event.content), )*