mirror of
https://codeberg.org/icewind/vdf-reader.git
synced 2026-06-03 10:04:08 +02:00
clippy fixes
This commit is contained in:
parent
842cf2407c
commit
8e7b385646
2 changed files with 9 additions and 5 deletions
|
|
@ -38,12 +38,16 @@ mod tests {
|
|||
use super::Token;
|
||||
use logos::Logos;
|
||||
|
||||
fn get_token(input: &str) -> Option<Result<Token, <Token as Logos>::Error>> {
|
||||
fn get_token<'input>(
|
||||
input: &'input str,
|
||||
) -> Option<Result<Token, <Token as Logos<'input>>::Error>> {
|
||||
let mut lex = Token::lexer(input);
|
||||
lex.next()
|
||||
}
|
||||
|
||||
fn get_tokens(input: &str) -> Result<Vec<(Token, &str)>, <Token as Logos>::Error> {
|
||||
fn get_tokens<'input>(
|
||||
input: &str,
|
||||
) -> Result<Vec<(Token, &str)>, <Token as Logos<'input>>::Error> {
|
||||
Token::lexer(input)
|
||||
.spanned()
|
||||
.map(|(res, span)| res.map(|token| (token, &input[span])))
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ impl<'a> From<&'a str> for Reader<'a> {
|
|||
}
|
||||
|
||||
impl<'a> Reader<'a> {
|
||||
fn token(&mut self) -> Option<(Result<Token, <Token as Logos>::Error>, Span)> {
|
||||
fn token(&mut self) -> Option<(Result<Token, <Token as Logos<'a>>::Error>, Span)> {
|
||||
self.lexer.next()
|
||||
}
|
||||
|
||||
|
|
@ -194,7 +194,7 @@ impl<'a> Iterator for Reader<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn quoted_string(source: &str) -> Cow<str> {
|
||||
pub(crate) fn quoted_string<'a>(source: &'a str) -> Cow<'a, str> {
|
||||
let source = &source[1..source.len() - 1];
|
||||
|
||||
if source.contains(r#"\""#) || source.contains(r#"\\"#) {
|
||||
|
|
@ -220,6 +220,6 @@ pub(crate) fn quoted_string(source: &str) -> Cow<str> {
|
|||
}
|
||||
}
|
||||
|
||||
fn string(source: &str) -> Cow<str> {
|
||||
fn string<'a>(source: &'a str) -> Cow<'a, str> {
|
||||
source.into()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue