Skip to content

Commit 8110d43

Browse files
committed
Fix MSRV and clippy CI
1 parent dbd5261 commit 8110d43

File tree

6 files changed

+36
-57
lines changed

6 files changed

+36
-57
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ jobs:
4141
matrix.rust == '1.63.0'
4242
run: |
4343
cargo update -p idna_adapter --precise 1.1.0
44+
cargo update -p getopts --precise 0.2.22
45+
cargo update -p unicode-width --precise 0.1.12
4446
- name: Add `aarch64-unknown-none` toolchain for `no_std` tests
4547
if: |
4648
matrix.os == 'ubuntu-latest' &&

url/src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1909,7 +1909,7 @@ impl Url {
19091909
(_, Some(new)) => {
19101910
let path_and_after = self.slice(self.path_start..).to_owned();
19111911
self.serialization.truncate(self.host_end as usize);
1912-
write!(&mut self.serialization, ":{}", new).unwrap();
1912+
write!(&mut self.serialization, ":{new}").unwrap();
19131913
let old_path_start = self.path_start;
19141914
let new_path_start = to_u32(self.serialization.len()).unwrap();
19151915
self.path_start = new_path_start;
@@ -2092,14 +2092,14 @@ impl Url {
20922092
self.username_end += 2;
20932093
self.host_start += 2;
20942094
}
2095-
write!(&mut self.serialization, "{}", host).unwrap();
2095+
write!(&mut self.serialization, "{host}").unwrap();
20962096
self.host_end = to_u32(self.serialization.len()).unwrap();
20972097
self.host = host.into();
20982098

20992099
if let Some(new_port) = opt_new_port {
21002100
self.port = new_port;
21012101
if let Some(port) = new_port {
2102-
write!(&mut self.serialization, ":{}", port).unwrap();
2102+
write!(&mut self.serialization, ":{port}").unwrap();
21032103
}
21042104
}
21052105
let new_suffix_pos = to_u32(self.serialization.len()).unwrap();
@@ -2926,7 +2926,7 @@ impl<'de> serde::Deserialize<'de> for Url {
29262926
where
29272927
E: Error,
29282928
{
2929-
Url::parse(s).map_err(|err| Error::custom(format!("{}: {:?}", err, s)))
2929+
Url::parse(s).map_err(|err| Error::custom(format!("{err}: {s:?}")))
29302930
}
29312931
}
29322932

@@ -3013,7 +3013,7 @@ fn path_to_file_url_segments_windows(
30133013
}
30143014
Prefix::UNC(server, share) | Prefix::VerbatimUNC(server, share) => {
30153015
let host = Host::parse_cow(server.to_str().ok_or(())?.into()).map_err(|_| ())?;
3016-
write!(serialization, "{}", host).unwrap();
3016+
write!(serialization, "{host}").unwrap();
30173017
host_end = to_u32(serialization.len()).unwrap();
30183018
host_internal = host.into();
30193019
serialization.push('/');

url/src/origin.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ impl Origin {
8080
Self::Opaque(_) => "null".to_owned(),
8181
Self::Tuple(ref scheme, ref host, port) => {
8282
if default_port(scheme) == Some(port) {
83-
format!("{}://{}", scheme, host)
83+
format!("{scheme}://{host}")
8484
} else {
85-
format!("{}://{}:{}", scheme, host, port)
85+
format!("{scheme}://{host}:{port}")
8686
}
8787
}
8888
}
@@ -101,9 +101,9 @@ impl Origin {
101101
_ => host.clone(),
102102
};
103103
if default_port(scheme) == Some(port) {
104-
format!("{}://{}", scheme, host)
104+
format!("{scheme}://{host}")
105105
} else {
106-
format!("{}://{}:{}", scheme, host, port)
106+
format!("{scheme}://{host}:{port}")
107107
}
108108
}
109109
}

url/src/parser.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,7 @@ impl Parser<'_> {
958958
scheme_type: SchemeType,
959959
) -> ParseResult<(u32, HostInternal, Option<u16>, Input<'i>)> {
960960
let (host, remaining) = Parser::parse_host(input, scheme_type)?;
961-
write!(&mut self.serialization, "{}", host).unwrap();
961+
write!(&mut self.serialization, "{host}").unwrap();
962962
let host_end = to_u32(self.serialization.len())?;
963963
if let Host::Domain(h) = &host {
964964
if h.is_empty() {
@@ -1070,7 +1070,7 @@ impl Parser<'_> {
10701070
HostInternal::None
10711071
}
10721072
host => {
1073-
write!(&mut self.serialization, "{}", host).unwrap();
1073+
write!(&mut self.serialization, "{host}").unwrap();
10741074
has_host = true;
10751075
host.into()
10761076
}

url/tests/unit.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,16 +1247,12 @@ fn test_make_relative() {
12471247
let make_relative = base_uri.make_relative(&relative_uri).unwrap();
12481248
assert_eq!(
12491249
make_relative, *relative,
1250-
"base: {}, uri: {}, relative: {}",
1251-
base, uri, relative
1250+
"base: {base}, uri: {uri}, relative: {relative}"
12521251
);
12531252
assert_eq!(
12541253
base_uri.join(relative).unwrap().as_str(),
12551254
*uri,
1256-
"base: {}, uri: {}, relative: {}",
1257-
base,
1258-
uri,
1259-
relative
1255+
"base: {base}, uri: {uri}, relative: {relative}"
12601256
);
12611257
}
12621258

@@ -1271,7 +1267,7 @@ fn test_make_relative() {
12711267
let base_uri = url::Url::parse(base).unwrap();
12721268
let relative_uri = url::Url::parse(uri).unwrap();
12731269
let make_relative = base_uri.make_relative(&relative_uri);
1274-
assert_eq!(make_relative, None, "base: {}, uri: {}", base, uri);
1270+
assert_eq!(make_relative, None, "base: {base}, uri: {uri}");
12751271
}
12761272
}
12771273

url/tests/wpt.rs

Lines changed: 20 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ fn main() {
171171
if should_skip(&name, filter.as_deref()) {
172172
continue;
173173
}
174-
print!("{} ... ", name);
174+
print!("{name} ... ");
175175

176176
let res = run_url_test(url_test);
177177
report(name, res, &mut errors, &mut expected_failures);
@@ -189,7 +189,7 @@ fn main() {
189189
continue;
190190
}
191191

192-
print!("{} ... ", name);
192+
print!("{name} ... ");
193193

194194
let res = run_setter_test(&kind, test);
195195
report(name, res, &mut errors, &mut expected_failures);
@@ -205,8 +205,8 @@ fn main() {
205205
println!();
206206

207207
for (name, err) in errors {
208-
println!(" name: {}", name);
209-
println!(" err: {}", err);
208+
println!(" name: {name}");
209+
println!(" err: {err}");
210210
println!();
211211
}
212212

@@ -223,7 +223,7 @@ fn main() {
223223
println!();
224224

225225
for name in expected_failures {
226-
println!(" {}", name);
226+
println!(" {name}");
227227
}
228228

229229
println!();
@@ -278,8 +278,7 @@ fn run_url_test(
278278
) -> Result<(), String> {
279279
let base = match base {
280280
Some(base) => {
281-
let base =
282-
Url::parse(&base).map_err(|e| format!("errored while parsing base: {}", e))?;
281+
let base = Url::parse(&base).map_err(|e| format!("errored while parsing base: {e}"))?;
283282
Some(base)
284283
}
285284
None => None,
@@ -288,7 +287,7 @@ fn run_url_test(
288287
let res = Url::options()
289288
.base_url(base.as_ref())
290289
.parse(&input)
291-
.map_err(|e| format!("errored while parsing input: {}", e));
290+
.map_err(|e| format!("errored while parsing input: {e}"));
292291

293292
match result {
294293
UrlTestResult::Ok(ok) => check_url_ok(res, ok),
@@ -307,7 +306,7 @@ fn check_url_ok(res: Result<Url, String>, ok: UrlTestOk) -> Result<(), String> {
307306
let url = match res {
308307
Ok(url) => url,
309308
Err(err) => {
310-
return Err(format!("expected success, but errored: {:?}", err));
309+
return Err(format!("expected success, but errored: {err:?}"));
311310
}
312311
};
313312

@@ -390,7 +389,7 @@ fn run_setter_test(
390389
expected,
391390
}: SetterTest,
392391
) -> Result<(), String> {
393-
let mut url = Url::parse(&href).map_err(|e| format!("errored while parsing href: {}", e))?;
392+
let mut url = Url::parse(&href).map_err(|e| format!("errored while parsing href: {e}"))?;
394393

395394
match kind {
396395
"protocol" => {
@@ -415,26 +414,22 @@ fn run_setter_test(
415414
"search" => url::quirks::set_search(&mut url, &new_value),
416415
"hash" => url::quirks::set_hash(&mut url, &new_value),
417416
_ => {
418-
return Err(format!("unknown setter kind: {:?}", kind));
417+
return Err(format!("unknown setter kind: {kind:?}"));
419418
}
420419
}
421420

422421
if let Some(expected_href) = expected.href {
423422
let href = url::quirks::href(&url);
424423
if href != expected_href {
425-
return Err(format!(
426-
"expected href {:?}, but got {:?}",
427-
expected_href, href
428-
));
424+
return Err(format!("expected href {expected_href:?}, but got {href:?}"));
429425
}
430426
}
431427

432428
if let Some(expected_protocol) = expected.protocol {
433429
let protocol = url::quirks::protocol(&url);
434430
if protocol != expected_protocol {
435431
return Err(format!(
436-
"expected protocol {:?}, but got {:?}",
437-
expected_protocol, protocol
432+
"expected protocol {expected_protocol:?}, but got {protocol:?}"
438433
));
439434
}
440435
}
@@ -443,8 +438,7 @@ fn run_setter_test(
443438
let username = url::quirks::username(&url);
444439
if username != expected_username {
445440
return Err(format!(
446-
"expected username {:?}, but got {:?}",
447-
expected_username, username
441+
"expected username {expected_username:?}, but got {username:?}"
448442
));
449443
}
450444
}
@@ -453,48 +447,39 @@ fn run_setter_test(
453447
let password = url::quirks::password(&url);
454448
if password != expected_password {
455449
return Err(format!(
456-
"expected password {:?}, but got {:?}",
457-
expected_password, password
450+
"expected password {expected_password:?}, but got {password:?}"
458451
));
459452
}
460453
}
461454

462455
if let Some(expected_host) = expected.host {
463456
let host = url::quirks::host(&url);
464457
if host != expected_host {
465-
return Err(format!(
466-
"expected host {:?}, but got {:?}",
467-
expected_host, host
468-
));
458+
return Err(format!("expected host {expected_host:?}, but got {host:?}"));
469459
}
470460
}
471461

472462
if let Some(expected_hostname) = expected.hostname {
473463
let hostname = url::quirks::hostname(&url);
474464
if hostname != expected_hostname {
475465
return Err(format!(
476-
"expected hostname {:?}, but got {:?}",
477-
expected_hostname, hostname
466+
"expected hostname {expected_hostname:?}, but got {hostname:?}"
478467
));
479468
}
480469
}
481470

482471
if let Some(expected_port) = expected.port {
483472
let port = url::quirks::port(&url);
484473
if port != expected_port {
485-
return Err(format!(
486-
"expected port {:?}, but got {:?}",
487-
expected_port, port
488-
));
474+
return Err(format!("expected port {expected_port:?}, but got {port:?}"));
489475
}
490476
}
491477

492478
if let Some(expected_pathname) = expected.pathname {
493479
let pathname = url::quirks::pathname(&url);
494480
if pathname != expected_pathname {
495481
return Err(format!(
496-
"expected pathname {:?}, but got {:?}",
497-
expected_pathname, pathname
482+
"expected pathname {expected_pathname:?}, but got {pathname:?}"
498483
));
499484
}
500485
}
@@ -503,19 +488,15 @@ fn run_setter_test(
503488
let search = url::quirks::search(&url);
504489
if search != expected_search {
505490
return Err(format!(
506-
"expected search {:?}, but got {:?}",
507-
expected_search, search
491+
"expected search {expected_search:?}, but got {search:?}"
508492
));
509493
}
510494
}
511495

512496
if let Some(expected_hash) = expected.hash {
513497
let hash = url::quirks::hash(&url);
514498
if hash != expected_hash {
515-
return Err(format!(
516-
"expected hash {:?}, but got {:?}",
517-
expected_hash, hash
518-
));
499+
return Err(format!("expected hash {expected_hash:?}, but got {hash:?}"));
519500
}
520501
}
521502

0 commit comments

Comments
 (0)