macros: Always implement IncomingRequest trait on IncomingRequest type

… rather than the `Request` type, even if `IncomingRequest` is a type
alias for it.

This (only) affects where the implementation is shown in the
documentation.
This commit is contained in:
Jonas Platte 2022-10-31 09:57:42 +01:00
parent 920e51b468
commit b7c47c9e70
No known key found for this signature in database
GPG Key ID: AAA7A61F696C3E0C
2 changed files with 1 additions and 14 deletions

View File

@ -154,13 +154,6 @@ impl Request {
self.fields.iter().any(|f| matches!(&f.kind, RequestFieldKind::Query)) self.fields.iter().any(|f| matches!(&f.kind, RequestFieldKind::Query))
} }
fn has_lifetimes(&self) -> bool {
!(self.lifetimes.body.is_empty()
&& self.lifetimes.path.is_empty()
&& self.lifetimes.query.is_empty()
&& self.lifetimes.header.is_empty())
}
fn header_fields(&self) -> impl Iterator<Item = (&Field, &Ident)> { fn header_fields(&self) -> impl Iterator<Item = (&Field, &Ident)> {
self.fields.iter().filter_map(RequestField::as_header_field) self.fields.iter().filter_map(RequestField::as_header_field)
} }

View File

@ -12,12 +12,6 @@ impl Request {
let error_ty = &self.error_ty; let error_ty = &self.error_ty;
let incoming_request_type = if self.has_lifetimes() {
quote! { IncomingRequest }
} else {
quote! { Request }
};
// FIXME: the rest of the field initializer expansions are gated `cfg(...)` // FIXME: the rest of the field initializer expansions are gated `cfg(...)`
// except this one. If we get errors about missing fields in IncomingRequest for // except this one. If we get errors about missing fields in IncomingRequest for
// a path field look here. // a path field look here.
@ -179,7 +173,7 @@ impl Request {
quote! { quote! {
#[automatically_derived] #[automatically_derived]
#[cfg(feature = "server")] #[cfg(feature = "server")]
impl #ruma_common::api::IncomingRequest for #incoming_request_type { impl #ruma_common::api::IncomingRequest for IncomingRequest {
type EndpointError = #error_ty; type EndpointError = #error_ty;
type OutgoingResponse = Response; type OutgoingResponse = Response;