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);
Some(quote! {
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;
std::option::Option::Some(std::boxed::Box::new(format!(#fmt #args)))
}
@ -134,7 +134,7 @@ impl Help {
let var = quote! { __miette_internal_var };
Some(quote! {
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;
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)) })

View File

@ -225,7 +225,7 @@ impl Labels {
});
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> + '_>> {
use miette::macro_helpers::ToOption;
let Self #display_pat = self;

View File

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

View File

@ -130,7 +130,7 @@ impl Url {
};
Some(quote! {
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;
std::option::Option::Some(std::boxed::Box::new(format!(#fmt #args)))
}