diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:11:38 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:13:23 +0000 |
commit | 20431706a863f92cb37dc512fef6e48d192aaf2c (patch) | |
tree | 2867f13f5fd5437ba628c67d7f87309ccadcd286 /vendor/idna/tests/uts46.rs | |
parent | Releasing progress-linux version 1.65.0+dfsg1-2~progress7.99u1. (diff) | |
download | rustc-20431706a863f92cb37dc512fef6e48d192aaf2c.tar.xz rustc-20431706a863f92cb37dc512fef6e48d192aaf2c.zip |
Merging upstream version 1.66.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/idna/tests/uts46.rs')
-rw-r--r-- | vendor/idna/tests/uts46.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/vendor/idna/tests/uts46.rs b/vendor/idna/tests/uts46.rs index 72b5bcec7..bd402ce97 100644 --- a/vendor/idna/tests/uts46.rs +++ b/vendor/idna/tests/uts46.rs @@ -8,6 +8,7 @@ use crate::test::TestFn; use std::char; +use std::fmt::Write; use idna::Errors; @@ -25,10 +26,10 @@ pub fn collect_tests<F: FnMut(String, TestFn)>(add_test: &mut F) { }; let mut pieces = line.split(';').map(|x| x.trim()).collect::<Vec<&str>>(); - let source = unescape(&pieces.remove(0)); + let source = unescape(pieces.remove(0)); // ToUnicode - let mut to_unicode = unescape(&pieces.remove(0)); + let mut to_unicode = unescape(pieces.remove(0)); if to_unicode.is_empty() { to_unicode = source.clone(); } @@ -65,7 +66,7 @@ pub fn collect_tests<F: FnMut(String, TestFn)>(add_test: &mut F) { let test_name = format!("UTS #46 line {}", i + 1); add_test( test_name, - TestFn::dyn_test_fn(move || { + TestFn::DynTestFn(Box::new(move || { let config = idna::Config::default() .use_std3_ascii_rules(true) .verify_dns_length(true) @@ -109,7 +110,7 @@ pub fn collect_tests<F: FnMut(String, TestFn)>(add_test: &mut F) { to_ascii_t_result, |e| e.starts_with('C') || e == "V2", ); - }), + })), ) } } @@ -160,8 +161,8 @@ fn unescape(input: &str) -> String { match char::from_u32(((c1 * 16 + c2) * 16 + c3) * 16 + c4) { Some(c) => output.push(c), None => { - output - .push_str(&format!("\\u{:X}{:X}{:X}{:X}", c1, c2, c3, c4)); + write!(&mut output, "\\u{:X}{:X}{:X}{:X}", c1, c2, c3, c4) + .expect("Could not write to output"); } }; } |