Use #[deprecated] instead of doc comments

This commit is contained in:
HKalbasi 2023-02-12 10:18:06 -08:00 committed by GitHub
parent e653912e22
commit ca99c97a0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 25 additions and 16 deletions

View File

@ -42,9 +42,8 @@ pub mod v3 {
pub next_link: Option<String>,
/// Optional identity server hostname and access token.
///
/// Deprecated since r0.6.0.
#[serde(flatten, skip_serializing_if = "Option::is_none")]
#[deprecated(since = "0.6.0")]
pub identity_server_info: Option<IdentityServerInfo>,
}
@ -70,6 +69,7 @@ pub mod v3 {
impl Request {
/// Creates a new `Request` with the client secret, email and send-attempt counter.
#[allow(deprecated)]
pub fn new(client_secret: OwnedClientSecret, email: String, send_attempt: UInt) -> Self {
Self { client_secret, email, send_attempt, next_link: None, identity_server_info: None }
}

View File

@ -45,9 +45,8 @@ pub mod v3 {
pub next_link: Option<String>,
/// Optional identity server hostname and access token.
///
/// Deprecated since r0.6.0.
#[serde(flatten, skip_serializing_if = "Option::is_none")]
#[deprecated(since = "0.6.0")]
pub identity_server_info: Option<IdentityServerInfo>,
}
@ -74,6 +73,7 @@ pub mod v3 {
impl Request {
/// Creates a new `Request` with the given client secret, country code, phone number and
/// send-attempt counter.
#[allow(deprecated)]
pub fn new(
client_secret: OwnedClientSecret,
country: String,

View File

@ -42,9 +42,8 @@ pub mod v3 {
pub next_link: Option<String>,
/// Optional identity server hostname and access token.
///
/// Deprecated since r0.6.0.
#[serde(flatten, skip_serializing_if = "Option::is_none")]
#[deprecated(since = "0.6.0")]
pub identity_server_info: Option<IdentityServerInfo>,
}
@ -71,6 +70,7 @@ pub mod v3 {
impl Request {
/// Creates a new `Request` with the given client secret, email address and send-attempt
/// counter.
#[allow(deprecated)]
pub fn new(client_secret: OwnedClientSecret, email: String, send_attempt: UInt) -> Self {
Self { client_secret, email, send_attempt, next_link: None, identity_server_info: None }
}

View File

@ -42,9 +42,8 @@ pub mod v3 {
pub next_link: Option<String>,
/// Optional identity server hostname and access token.
///
/// Deprecated since r0.6.0.
#[serde(flatten, skip_serializing_if = "Option::is_none")]
#[deprecated(since = "0.6.0")]
pub identity_server_info: Option<IdentityServerInfo>,
}
@ -71,6 +70,7 @@ pub mod v3 {
impl Request {
/// Creates a new `Request` with the given client secret, email address and send-attempt
/// counter.
#[allow(deprecated)]
pub fn new(client_secret: OwnedClientSecret, email: String, send_attempt: UInt) -> Self {
Self { client_secret, email, send_attempt, next_link: None, identity_server_info: None }
}

View File

@ -45,9 +45,8 @@ pub mod v3 {
pub next_link: Option<String>,
/// Optional identity server hostname and access token.
///
/// Deprecated since r0.6.0.
#[serde(flatten, skip_serializing_if = "Option::is_none")]
#[deprecated(since = "0.6.0")]
pub identity_server_info: Option<IdentityServerInfo>,
}
@ -74,6 +73,7 @@ pub mod v3 {
impl Request {
/// Creates a new `Request` with the given client secret, country code, phone number and
/// send-attempt counter.
#[allow(deprecated)]
pub fn new(
client_secret: OwnedClientSecret,
country: String,

View File

@ -67,10 +67,8 @@ pub mod v3 {
pub access_token: String,
/// The hostname of the homeserver on which the account has been registered.
///
/// Deprecated: Clients should instead use the `user_id.server_name()`
/// method if they require it.
#[serde(skip_serializing_if = "Option::is_none")]
#[deprecated = "Clients should instead use the `user_id.server_name()` method if they require it."]
pub home_server: Option<OwnedServerName>,
/// ID of the logged-in device.
@ -124,6 +122,7 @@ pub mod v3 {
impl Response {
/// Creates a new `Response` with the given user ID, access token and device ID.
#[allow(deprecated)]
pub fn new(user_id: OwnedUserId, access_token: String, device_id: OwnedDeviceId) -> Self {
Self {
user_id,

View File

@ -81,7 +81,12 @@ pub fn expand_derive_request(input: DeriveInput) -> syn::Result<TokenStream> {
Ok(quote! {
#types_impls
#test
#[allow(deprecated)]
#[cfg(tests)]
mod __request {
#test
}
})
}
@ -183,8 +188,12 @@ impl Request {
#request_body_struct
#request_query_struct
#outgoing_request_impl
#incoming_request_impl
#[allow(deprecated)]
mod __request_impls {
use super::*;
#outgoing_request_impl
#incoming_request_impl
}
}
}
@ -242,6 +251,7 @@ impl Request {
let path_fields = self.path_fields().map(|f| f.ident.as_ref().unwrap().to_string());
let mut tests = quote! {
#[::std::prelude::v1::test]
#[allow(deprecated)]
fn path_parameters() {
let path_params = METADATA._path_parameters();
let request_path_fields: &[&::std::primitive::str] = &[#(#path_fields),*];