Skip to content

Commit f8083ec

Browse files
authored
Fix compiler warnings (#75)
It would seem a Rust compiler update has resulted in some new warnings from the `mismatched_lifetime_syntaxes` lint, highlighting some inconsistencies in how lifetimes are expressed. This branch clears the warnings.
2 parents 46c75bc + 9016230 commit f8083ec

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

src/language/quantity.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub struct Decimal {
3838
}
3939

4040
/// Parse a string as a Quantity if it matches the expected format
41-
pub fn parse_quantity(input: &str) -> Option<Quantity> {
41+
pub fn parse_quantity(input: &str) -> Option<Quantity<'_>> {
4242
// Look for patterns that indicate a quantity:
4343
// - decimal number followed by space and unit symbol
4444
// - decimal number with uncertainty (±)

src/language/types.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ pub fn validate_template(input: &str) -> Option<&str> {
244244
}
245245
}
246246

247-
pub fn validate_identifier(input: &str) -> Option<Identifier> {
247+
pub fn validate_identifier(input: &str) -> Option<Identifier<'_>> {
248248
if input.len() == 0 {
249249
return None;
250250
}
@@ -257,7 +257,7 @@ pub fn validate_identifier(input: &str) -> Option<Identifier> {
257257
}
258258
}
259259

260-
pub fn validate_forma(input: &str) -> Option<Forma> {
260+
pub fn validate_forma(input: &str) -> Option<Forma<'_>> {
261261
if input.len() == 0 {
262262
return None;
263263
}
@@ -281,7 +281,7 @@ pub fn validate_forma(input: &str) -> Option<Forma> {
281281
Some(Forma(input))
282282
}
283283

284-
fn parse_tuple(input: &str) -> Option<Vec<Forma>> {
284+
fn parse_tuple(input: &str) -> Option<Vec<Forma<'_>>> {
285285
let mut formas: Vec<Forma> = Vec::new();
286286

287287
for text in input.split(",") {
@@ -294,7 +294,7 @@ fn parse_tuple(input: &str) -> Option<Vec<Forma>> {
294294
}
295295

296296
/// This one copes with (and discards) any internal whitespace encountered.
297-
pub fn validate_genus(input: &str) -> Option<Genus> {
297+
pub fn validate_genus(input: &str) -> Option<Genus<'_>> {
298298
let first = input
299299
.chars()
300300
.next()
@@ -349,7 +349,7 @@ pub fn validate_genus(input: &str) -> Option<Genus> {
349349
}
350350
}
351351

352-
pub fn validate_response(input: &str) -> Option<Response> {
352+
pub fn validate_response(input: &str) -> Option<Response<'_>> {
353353
if input.len() == 0 {
354354
return None;
355355
}
@@ -371,14 +371,14 @@ pub fn validate_response(input: &str) -> Option<Response> {
371371
Some(Response { value, condition })
372372
}
373373

374-
fn _validate_decimal(_input: &str) -> Option<Numeric> {
374+
fn _validate_decimal(_input: &str) -> Option<Numeric<'_>> {
375375
// Test the regex macro availability within types.rs
376376
let _decimal_regex = regex!(r"^\s*-?[0-9]+\.[0-9]+\s*$");
377377
// For now, just return None since we removed Decimal variant
378378
None
379379
}
380380

381-
pub fn validate_numeric(input: &str) -> Option<Numeric> {
381+
pub fn validate_numeric(input: &str) -> Option<Numeric<'_>> {
382382
if input.is_empty() {
383383
return None;
384384
}

src/parsing/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ mod scope;
1212
/// Read a file and return an owned String. We pass that ownership back to the
1313
/// main function so that the Technique object created by parse() below can
1414
/// have the same lifetime.
15-
pub fn load(filename: &Path) -> Result<String, LoadingError> {
15+
pub fn load(filename: &Path) -> Result<String, LoadingError<'_>> {
1616
match std::fs::read_to_string(filename) {
1717
Ok(content) => Ok(content),
1818
Err(error) => {

src/rendering/typst.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ impl Render for Typst {
4242
}
4343
}
4444

45-
fn escape_typst(content: &str) -> Cow<str> {
45+
fn escape_typst(content: &str) -> Cow<'_, str> {
4646
if content.contains('"') {
4747
Cow::Owned(content.replace("\"", "\\\""))
4848
} else {

0 commit comments

Comments
 (0)