frontend-utils: Drop 'static bound from push_key

This commit is contained in:
sleepycatcoding 2024-04-26 01:22:13 +03:00 committed by Nathan Adams
parent 4df57bb122
commit c95d02339e
4 changed files with 11 additions and 11 deletions

View File

@ -64,8 +64,8 @@ pub fn read_preferences(input: &str) -> ParseDetails<SavedGlobalPreferences> {
}); });
ParseDetails { ParseDetails {
result: DocumentHolder::new(result, document),
warnings: cx.warnings, warnings: cx.warnings,
result: DocumentHolder::new(result, document),
} }
} }

View File

@ -35,8 +35,8 @@ pub fn read_bookmarks(input: &str) -> ParseDetails<Bookmarks> {
}); });
ParseDetails { ParseDetails {
result: DocumentHolder::new(result, document),
warnings: cx.warnings, warnings: cx.warnings,
result: DocumentHolder::new(result, document),
} }
} }

View File

@ -46,8 +46,8 @@ impl BundleInformation {
.unwrap_or(Err(BundleInformationParseError::InvalidBundleSection))?; .unwrap_or(Err(BundleInformationParseError::InvalidBundleSection))?;
Ok(ParseDetails { Ok(ParseDetails {
result: DocumentHolder::new(result, document),
warnings: cx.warnings, warnings: cx.warnings,
result: DocumentHolder::new(result, document),
}) })
} }
} }

View File

@ -124,14 +124,14 @@ impl fmt::Display for ParseWarning {
} }
#[derive(Default)] #[derive(Default)]
pub struct ParseContext { pub struct ParseContext<'a> {
pub warnings: Vec<ParseWarning>, pub warnings: Vec<ParseWarning>,
/// Path of the current item being parsed /// Path of the current item being parsed
path: Vec<&'static str>, path: Vec<&'a str>,
} }
impl ParseContext { impl<'a> ParseContext<'a> {
pub fn push_key(&mut self, key: &'static str) { pub fn push_key(&mut self, key: &'a str) {
self.path.push(key); self.path.push(key);
} }
@ -166,9 +166,9 @@ pub trait ReadExt<'a> {
fn get_table_like<R>( fn get_table_like<R>(
&'a self, &'a self,
cx: &mut ParseContext, cx: &mut ParseContext<'a>,
key: &'static str, key: &'static str,
fun: impl FnOnce(&mut ParseContext, &dyn TableLike) -> R, fun: impl FnOnce(&mut ParseContext<'a>, &'a dyn TableLike) -> R,
) -> Option<R> { ) -> Option<R> {
let mut result = None; let mut result = None;
if let Some(item) = self.get_impl(key) { if let Some(item) = self.get_impl(key) {
@ -187,9 +187,9 @@ pub trait ReadExt<'a> {
fn get_array_of_tables<R>( fn get_array_of_tables<R>(
&'a self, &'a self,
cx: &mut ParseContext, cx: &mut ParseContext<'a>,
key: &'static str, key: &'static str,
fun: impl FnOnce(&mut ParseContext, &ArrayOfTables) -> R, fun: impl FnOnce(&mut ParseContext<'a>, &'a ArrayOfTables) -> R,
) -> Option<R> { ) -> Option<R> {
let mut result = None; let mut result = None;
if let Some(item) = self.get_impl(key) { if let Some(item) = self.get_impl(key) {