File tree Expand file tree Collapse file tree 2 files changed +11
-19
lines changed Expand file tree Collapse file tree 2 files changed +11
-19
lines changed Original file line number Diff line number Diff line change 1
1
extern crate idna;
2
2
extern crate unicode_normalization;
3
3
4
- use idna:: uts46;
5
4
use unicode_normalization:: char:: is_combining_mark;
6
5
7
- fn _to_ascii ( domain : & str ) -> Result < String , uts46:: Errors > {
8
- uts46:: to_ascii (
9
- domain,
10
- uts46:: Flags {
11
- transitional_processing : false ,
12
- use_std3_ascii_rules : true ,
13
- verify_dns_length : true ,
14
- } ,
15
- )
6
+ fn _to_ascii ( domain : & str ) -> Result < String , idna:: Errors > {
7
+ idna:: Config :: default ( )
8
+ . verify_dns_length ( true )
9
+ . use_std3_ascii_rules ( true )
10
+ . to_ascii ( domain)
16
11
}
17
12
18
13
#[ test]
Original file line number Diff line number Diff line change 6
6
// option. This file may not be copied, modified, or distributed
7
7
// except according to those terms.
8
8
9
- use idna:: uts46;
10
9
use std:: char;
11
10
use test:: TestFn ;
12
11
@@ -49,14 +48,12 @@ pub fn collect_tests<F: FnMut(String, TestFn)>(add_test: &mut F) {
49
48
add_test (
50
49
test_name,
51
50
TestFn :: dyn_test_fn ( move || {
52
- let result = uts46:: to_ascii (
53
- & source,
54
- uts46:: Flags {
55
- use_std3_ascii_rules : true ,
56
- transitional_processing : test_type == "T" ,
57
- verify_dns_length : true ,
58
- } ,
59
- ) ;
51
+ let result = idna:: Config :: default ( )
52
+ . use_std3_ascii_rules ( true )
53
+ . verify_dns_length ( true )
54
+ . check_hyphens ( true )
55
+ . transitional_processing ( test_type == "T" )
56
+ . to_ascii ( & source) ;
60
57
61
58
if to_ascii. starts_with ( "[" ) {
62
59
if to_ascii. starts_with ( "[C" ) {
You can’t perform that action at this time.
0 commit comments