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 {
result: DocumentHolder::new(result, document),
warnings: cx.warnings,
result: DocumentHolder::new(result, document),
}
}

View File

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

View File

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

View File

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