Przeglądaj źródła

Have an explicit `impl Default for Config` in idna

Simon Sapin 7 lat temu
rodzic
commit
62cc6147d5
1 zmienionych plików z 17 dodań i 1 usunięć
  1. 17 1
      idna/src/uts46.rs

+ 17 - 1
idna/src/uts46.rs

@@ -371,7 +371,7 @@ fn processing(domain: &str, config: Config, errors: &mut Vec<Error>) -> String {
     validated
     validated
 }
 }
 
 
-#[derive(Clone, Copy, Default)]
+#[derive(Clone, Copy)]
 pub struct Config {
 pub struct Config {
     use_std3_ascii_rules: bool,
     use_std3_ascii_rules: bool,
     transitional_processing: bool,
     transitional_processing: bool,
@@ -379,6 +379,22 @@ pub struct Config {
     check_hyphens: bool,
     check_hyphens: bool,
 }
 }
 
 
+/// The defaults are that of https://url.spec.whatwg.org/#idna
+impl Default for Config {
+    fn default() -> Self {
+        Config {
+            use_std3_ascii_rules: false,
+            transitional_processing: false,
+            check_hyphens: false,
+            // check_bidi: true,
+            // check_joiners: true,
+
+            // Only use for to_ascii, not to_unicode
+            verify_dns_length: false,
+        }
+    }
+}
+
 impl Config {
 impl Config {
     #[inline]
     #[inline]
     pub fn use_std3_ascii_rules(mut self, value: bool) -> Self {
     pub fn use_std3_ascii_rules(mut self, value: bool) -> Self {