Skip to content

Commit 85ef22d

Browse files
committed
Merge branch 'main' into 162
2 parents 1e13aaf + e65cfc9 commit 85ef22d

7 files changed

+14
-15
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ fn main() {
3737
We appreciate your help!
3838

3939
The code of conduct from the Deno repository applies here too:
40-
https://github.com/denoland/deno/blob/main/CODE_OF_CONDUCT.md.
40+
https://github.com/denoland/deno/blob/main/.github/CODE_OF_CONDUCT.md.

src/canonicalize_and_process.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub fn canonicalize_protocol(value: &str) -> Result<String, Error> {
1313
if value.is_empty() {
1414
return Ok(String::new());
1515
}
16-
url::Url::parse(&format!("{}://dummy.test", value))
16+
url::Url::parse(&format!("{value}://dummy.test"))
1717
.map(|url| url.scheme().to_owned())
1818
.map_err(Error::Url)
1919
}
@@ -92,7 +92,7 @@ pub fn canonicalize_pathname(value: &str) -> Result<String, Error> {
9292
}
9393
let leading_slash = value.starts_with('/');
9494
let modified_value = if !leading_slash {
95-
format!("/-{}", value)
95+
format!("/-{value}")
9696
} else {
9797
value.to_string()
9898
};

src/component.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ fn generate_pattern_string(part_list: &[&Part], options: &Options) -> String {
238238
{
239239
result.push('*');
240240
} else {
241-
result.push_str(&format!("({})", FULL_WILDCARD_REGEXP_VALUE));
241+
result.push_str(&format!("({FULL_WILDCARD_REGEXP_VALUE})"));
242242
}
243243
}
244244
}

src/constructor_parser.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ impl<'a> ConstructorStringParser<'a> {
119119
if index < self.token_list.len() {
120120
&self.token_list[index]
121121
} else {
122-
assert!(self.token_list.len() <= 1);
122+
assert!(!self.token_list.is_empty());
123123
let token = self.token_list.last().unwrap();
124124
assert!(token.kind == TokenType::End);
125125
token

src/error.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@ use derive_more::Display;
22

33
use crate::tokenizer::TokenType;
44

5-
/// A error occuring during URL pattern construction, or matching.
5+
/// A error occurring during URL pattern construction, or matching.
66
#[derive(Display)]
77
pub enum Error {
88
#[display(fmt = "a relative input without a base URL is not valid")]
99
BaseUrlRequired,
1010

1111
#[display(
12-
fmt = "specifying both an init object, and a seperate base URL is not valid"
12+
fmt = "specifying both an init object, and a separate base URL is not valid"
1313
)]
1414
BaseUrlWithInit,
1515

16-
#[display(fmt = "tokenizer error: {} (at char {})", _0, _1)]
16+
#[display(fmt = "tokenizer error: {_0} (at char {_1})")]
1717
Tokenizer(TokenizerError, usize),
1818

19-
#[display(fmt = "parser error: {}", _0)]
19+
#[display(fmt = "parser error: {_0}")]
2020
Parser(ParserError),
2121

2222
Url(url::ParseError),
@@ -39,15 +39,15 @@ pub enum TokenizerError {
3939
IncompleteEscapeCode,
4040
#[display(fmt = "invalid name; must be at least length 1")]
4141
InvalidName,
42-
#[display(fmt = "invalid regex: {}", _0)]
42+
#[display(fmt = "invalid regex: {_0}")]
4343
InvalidRegex(&'static str),
4444
}
4545

4646
#[derive(Debug, Display)]
4747
pub enum ParserError {
48-
#[display(fmt = "expected token {}, found '{}' of type {}", _0, _2, _1)]
48+
#[display(fmt = "expected token {_0}, found '{_2}' of type {_1}")]
4949
ExpectedToken(TokenType, TokenType, String),
5050

51-
#[display(fmt = "pattern contains duplicate name {}", _0)]
51+
#[display(fmt = "pattern contains duplicate name {_0}")]
5252
DuplicateName(String),
5353
}

src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ mod tests {
592592
);
593593

594594
if let Some(reason) = case.skip {
595-
println!("🟠 Skipping: {}", reason);
595+
println!("🟠 Skipping: {reason}");
596596
return;
597597
}
598598

src/tokenizer.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,7 @@ pub fn tokenize(
134134
};
135135

136136
while tokenizer.index < tokenizer.input.len() {
137-
tokenizer.next_index = tokenizer.index;
138-
tokenizer.get_next_codepoint();
137+
tokenizer.seek_and_get_next_codepoint(tokenizer.index);
139138

140139
if tokenizer.code_point == Some('*') {
141140
tokenizer.add_token_with_default_pos_and_len(TokenType::Asterisk);

0 commit comments

Comments
 (0)