mirror of https://github.com/zkat/miette.git
fmt: cargo fmt --all
This commit is contained in:
parent
991a93619b
commit
3e5ee0ee4d
|
|
@ -50,9 +50,7 @@ impl Diagnostic {
|
||||||
DiagnosticArg::Severity(sev) => {
|
DiagnosticArg::Severity(sev) => {
|
||||||
severity = Some(sev);
|
severity = Some(sev);
|
||||||
}
|
}
|
||||||
DiagnosticArg::Help(hl) => {
|
DiagnosticArg::Help(hl) => help = Some(hl),
|
||||||
help = Some(hl)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let ident = input.ident.clone();
|
let ident = input.ident.clone();
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,10 @@ impl Parse for DiagnosticArg {
|
||||||
} else if ident == "help" {
|
} else if ident == "help" {
|
||||||
Ok(DiagnosticArg::Help(input.parse()?))
|
Ok(DiagnosticArg::Help(input.parse()?))
|
||||||
} else {
|
} else {
|
||||||
Err(syn::Error::new(ident.span(), "Unrecognized diagnostic option"))
|
Err(syn::Error::new(
|
||||||
|
ident.span(),
|
||||||
|
"Unrecognized diagnostic option",
|
||||||
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,10 +31,7 @@ impl Parse for Severity {
|
||||||
Ok(Severity(input.parse::<syn::LitStr>()?.parse()?))
|
Ok(Severity(input.parse::<syn::LitStr>()?.parse()?))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Err(syn::Error::new(
|
Err(syn::Error::new(ident.span(), "not a severity level."))
|
||||||
ident.span(),
|
|
||||||
"not a severity level.",
|
|
||||||
))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -150,15 +150,9 @@ fn fmt_help() {
|
||||||
#[derive(Debug, Diagnostic, Error)]
|
#[derive(Debug, Diagnostic, Error)]
|
||||||
#[error("welp")]
|
#[error("welp")]
|
||||||
enum FooEnum {
|
enum FooEnum {
|
||||||
#[diagnostic(
|
#[diagnostic(code(foo::x), help("{} {}", 1, "bar"))]
|
||||||
code(foo::x),
|
|
||||||
help("{} {}", 1, "bar"),
|
|
||||||
)]
|
|
||||||
X,
|
X,
|
||||||
}
|
}
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!("1 bar".to_string(), FooEnum::X.help().unwrap().to_string());
|
||||||
"1 bar".to_string(),
|
|
||||||
FooEnum::X.help().unwrap().to_string()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue