Remove the second lifetime from DiagnosticArg
.
Because it's always static. I'm surprised the compiler allowed this unused lifetime without any complaint.
This commit is contained in:
parent
f0426b77fc
commit
514a5d8d55
3 changed files with 5 additions and 5 deletions
|
@ -23,7 +23,7 @@ pub struct SuggestionsDisabled;
|
||||||
/// Simplified version of `FluentArg` that can implement `Encodable` and `Decodable`. Collection of
|
/// Simplified version of `FluentArg` that can implement `Encodable` and `Decodable`. Collection of
|
||||||
/// `DiagnosticArg` are converted to `FluentArgs` (consuming the collection) at the start of
|
/// `DiagnosticArg` are converted to `FluentArgs` (consuming the collection) at the start of
|
||||||
/// diagnostic emission.
|
/// diagnostic emission.
|
||||||
pub type DiagnosticArg<'iter, 'source> = (&'iter DiagnosticArgName, &'iter DiagnosticArgValue);
|
pub type DiagnosticArg<'iter> = (&'iter DiagnosticArgName, &'iter DiagnosticArgValue);
|
||||||
|
|
||||||
/// Name of a diagnostic argument.
|
/// Name of a diagnostic argument.
|
||||||
pub type DiagnosticArgName = Cow<'static, str>;
|
pub type DiagnosticArgName = Cow<'static, str>;
|
||||||
|
@ -909,7 +909,7 @@ impl Diagnostic {
|
||||||
// Exact iteration order of diagnostic arguments shouldn't make a difference to output because
|
// Exact iteration order of diagnostic arguments shouldn't make a difference to output because
|
||||||
// they're only used in interpolation.
|
// they're only used in interpolation.
|
||||||
#[allow(rustc::potential_query_instability)]
|
#[allow(rustc::potential_query_instability)]
|
||||||
pub fn args(&self) -> impl Iterator<Item = DiagnosticArg<'_, 'static>> {
|
pub fn args(&self) -> impl Iterator<Item = DiagnosticArg<'_>> {
|
||||||
self.args.iter()
|
self.args.iter()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -628,7 +628,7 @@ impl DiagCtxt {
|
||||||
pub fn eagerly_translate<'a>(
|
pub fn eagerly_translate<'a>(
|
||||||
&self,
|
&self,
|
||||||
message: DiagnosticMessage,
|
message: DiagnosticMessage,
|
||||||
args: impl Iterator<Item = DiagnosticArg<'a, 'static>>,
|
args: impl Iterator<Item = DiagnosticArg<'a>>,
|
||||||
) -> SubdiagnosticMessage {
|
) -> SubdiagnosticMessage {
|
||||||
SubdiagnosticMessage::Eager(Cow::from(self.eagerly_translate_to_string(message, args)))
|
SubdiagnosticMessage::Eager(Cow::from(self.eagerly_translate_to_string(message, args)))
|
||||||
}
|
}
|
||||||
|
@ -637,7 +637,7 @@ impl DiagCtxt {
|
||||||
pub fn eagerly_translate_to_string<'a>(
|
pub fn eagerly_translate_to_string<'a>(
|
||||||
&self,
|
&self,
|
||||||
message: DiagnosticMessage,
|
message: DiagnosticMessage,
|
||||||
args: impl Iterator<Item = DiagnosticArg<'a, 'static>>,
|
args: impl Iterator<Item = DiagnosticArg<'a>>,
|
||||||
) -> String {
|
) -> String {
|
||||||
let inner = self.inner.borrow();
|
let inner = self.inner.borrow();
|
||||||
let args = crate::translation::to_fluent_args(args);
|
let args = crate::translation::to_fluent_args(args);
|
||||||
|
|
|
@ -13,7 +13,7 @@ use std::error::Report;
|
||||||
/// Typically performed once for each diagnostic at the start of `emit_diagnostic` and then
|
/// Typically performed once for each diagnostic at the start of `emit_diagnostic` and then
|
||||||
/// passed around as a reference thereafter.
|
/// passed around as a reference thereafter.
|
||||||
pub fn to_fluent_args<'iter>(
|
pub fn to_fluent_args<'iter>(
|
||||||
iter: impl Iterator<Item = DiagnosticArg<'iter, 'static>>,
|
iter: impl Iterator<Item = DiagnosticArg<'iter>>,
|
||||||
) -> FluentArgs<'static> {
|
) -> FluentArgs<'static> {
|
||||||
let mut args = if let Some(size) = iter.size_hint().1 {
|
let mut args = if let Some(size) = iter.size_hint().1 {
|
||||||
FluentArgs::with_capacity(size)
|
FluentArgs::with_capacity(size)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue