This commit is contained in:
Sawa 2026-06-03 13:58:11 +09:00 committed by GitHub
commit 15a6ae248a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 5 additions and 5 deletions

View File

@ -124,7 +124,7 @@ impl Help {
let (fmt, args) = display.expand_shorthand_cloned(&display_members); let (fmt, args) = display.expand_shorthand_cloned(&display_members);
Some(quote! { Some(quote! {
fn help(&self) -> std::option::Option<std::boxed::Box<dyn std::fmt::Display + '_>> { fn help(&self) -> std::option::Option<std::boxed::Box<dyn std::fmt::Display + '_>> {
#[allow(unused_variables, deprecated)] #[allow(unused_variables, deprecated, unused_assignments)]
let Self #display_pat = self; let Self #display_pat = self;
std::option::Option::Some(std::boxed::Box::new(format!(#fmt #args))) std::option::Option::Some(std::boxed::Box::new(format!(#fmt #args)))
} }
@ -134,7 +134,7 @@ impl Help {
let var = quote! { __miette_internal_var }; let var = quote! { __miette_internal_var };
Some(quote! { Some(quote! {
fn help(&self) -> std::option::Option<std::boxed::Box<dyn std::fmt::Display + '_>> { fn help(&self) -> std::option::Option<std::boxed::Box<dyn std::fmt::Display + '_>> {
#[allow(unused_variables, deprecated)] #[allow(unused_variables, deprecated, unused_assignments)]
let Self #display_pat = self; let Self #display_pat = self;
use miette::macro_helpers::ToOption; use miette::macro_helpers::ToOption;
miette::macro_helpers::OptionalWrapper::<#ty>::new().to_option(&self.#member).as_ref().map(|#var| -> std::boxed::Box<dyn std::fmt::Display + '_> { std::boxed::Box::new(format!("{}", #var)) }) miette::macro_helpers::OptionalWrapper::<#ty>::new().to_option(&self.#member).as_ref().map(|#var| -> std::boxed::Box<dyn std::fmt::Display + '_> { std::boxed::Box::new(format!("{}", #var)) })

View File

@ -225,7 +225,7 @@ impl Labels {
}); });
Some(quote! { Some(quote! {
#[allow(unused_variables)] #[allow(unused_variables, unused_assignments)]
fn labels(&self) -> std::option::Option<std::boxed::Box<dyn std::iter::Iterator<Item = miette::LabeledSpan> + '_>> { fn labels(&self) -> std::option::Option<std::boxed::Box<dyn std::iter::Iterator<Item = miette::LabeledSpan> + '_>> {
use miette::macro_helpers::ToOption; use miette::macro_helpers::ToOption;
let Self #display_pat = self; let Self #display_pat = self;

View File

@ -73,7 +73,7 @@ impl SourceCode {
}; };
Some(quote! { Some(quote! {
#[allow(unused_variables)] #[allow(unused_variables, unused_assignments)]
fn source_code(&self) -> std::option::Option<&dyn miette::SourceCode> { fn source_code(&self) -> std::option::Option<&dyn miette::SourceCode> {
let Self #display_pat = self; let Self #display_pat = self;
#ret #ret

View File

@ -130,7 +130,7 @@ impl Url {
}; };
Some(quote! { Some(quote! {
fn url(&self) -> std::option::Option<std::boxed::Box<dyn std::fmt::Display + '_>> { fn url(&self) -> std::option::Option<std::boxed::Box<dyn std::fmt::Display + '_>> {
#[allow(unused_variables, deprecated)] #[allow(unused_variables, deprecated, unused_assignments)]
let Self #pat = self; let Self #pat = self;
std::option::Option::Some(std::boxed::Box::new(format!(#fmt #args))) std::option::Option::Some(std::boxed::Box::new(format!(#fmt #args)))
} }