Browse Source

idna: clean up clippy warnings

Dirkjan Ochtman 6 years ago
parent
commit
e003e93ecb
3 changed files with 10 additions and 9 deletions
  1. 4 4
      idna/src/make_uts46_mapping_table.py
  2. 2 1
      idna/src/uts46.rs
  3. 4 4
      idna/src/uts46_mapping_table.rs

+ 4 - 4
idna/src/make_uts46_mapping_table.py

@@ -149,7 +149,7 @@ def merge_single_char_ranges(ranges):
 optimized_ranges = list(merge_single_char_ranges(optimized_ranges))
 
 
-print("static TABLE: &'static [Range] = &[")
+print("static TABLE: &[Range] = &[")
 
 for ranges in optimized_ranges:
     first = ranges[0][0]
@@ -159,7 +159,7 @@ for ranges in optimized_ranges:
 
 print("];\n")
 
-print("static INDEX_TABLE: &'static [u16] = &[")
+print("static INDEX_TABLE: &[u16] = &[")
 
 SINGLE_MARKER = 1 << 15
 
@@ -174,7 +174,7 @@ for ranges in optimized_ranges:
 
 print("];\n")
 
-print("static MAPPING_TABLE: &'static [Mapping] = &[")
+print("static MAPPING_TABLE: &[Mapping] = &[")
 
 for ranges in optimized_ranges:
     for (first, last, mapping, unicode_str) in ranges:
@@ -187,5 +187,5 @@ print("];\n")
 def escape_str(s):
     return [escape_char(c) for c in s]
 
-print("static STRING_TABLE: &'static str = \"%s\";"
+print("static STRING_TABLE: &str = \"%s\";"
       % '\\\n  '.join(itertools.chain(*[escape_str(s) for s in strtab.keys()])))

+ 2 - 1
idna/src/uts46.rs

@@ -255,7 +255,7 @@ fn passes_bidi(label: &str, is_bidi_domain: bool) -> bool {
         }
     }
 
-    return true;
+    true
 }
 
 /// http://www.unicode.org/reports/tr46/#Validity_Criteria
@@ -477,6 +477,7 @@ impl Config {
     }
 }
 
+#[allow(clippy::enum_variant_names)]
 #[derive(PartialEq, Eq, Clone, Copy, Debug)]
 enum Error {
     PunycodeError,

+ 4 - 4
idna/src/uts46_mapping_table.rs

@@ -8,7 +8,7 @@
 
 // Generated by make_idna_table.py
 
-static TABLE: &'static [Range] = &[
+static TABLE: &[Range] = &[
     Range { from: '\u{0}', to: '\u{2c}', },
     Range { from: '\u{2d}', to: '\u{2e}', },
     Range { from: '\u{2f}', to: '\u{2f}', },
@@ -1661,7 +1661,7 @@ static TABLE: &'static [Range] = &[
     Range { from: '\u{e01f0}', to: '\u{10ffff}', },
 ];
 
-static INDEX_TABLE: &'static [u16] = &[
+static INDEX_TABLE: &[u16] = &[
     32768,
     32769,
     32770,
@@ -3314,7 +3314,7 @@ static INDEX_TABLE: &'static [u16] = &[
     40550,
 ];
 
-static MAPPING_TABLE: &'static [Mapping] = &[
+static MAPPING_TABLE: &[Mapping] = &[
     DisallowedStd3Valid,
     Valid,
     DisallowedStd3Valid,
@@ -11100,7 +11100,7 @@ static MAPPING_TABLE: &'static [Mapping] = &[
     Disallowed,
 ];
 
-static STRING_TABLE: &'static str = "\u{61}\
+static STRING_TABLE: &str = "\u{61}\
   \u{62}\
   \u{63}\
   \u{64}\