@@ -452,7 +452,7 @@ macro_rules! from_integers {
452
452
let val = AsciiMetadataValue :: from( n) ;
453
453
assert_eq!( val, & n. to_string( ) ) ;
454
454
455
- let n = :: std :: $t:: MAX ;
455
+ let n = $t:: MAX ;
456
456
let val = AsciiMetadataValue :: from( n) ;
457
457
assert_eq!( val, & n. to_string( ) ) ;
458
458
}
@@ -771,86 +771,86 @@ fn test_from_shared_base64_encodes() {
771
771
772
772
#[ test]
773
773
fn test_value_eq_value ( ) {
774
- type BMV = BinaryMetadataValue ;
775
- type AMV = AsciiMetadataValue ;
774
+ type Bmv = BinaryMetadataValue ;
775
+ type Amv = AsciiMetadataValue ;
776
776
777
- assert_eq ! ( AMV :: from_static( "abc" ) , AMV :: from_static( "abc" ) ) ;
778
- assert_ne ! ( AMV :: from_static( "abc" ) , AMV :: from_static( "ABC" ) ) ;
777
+ assert_eq ! ( Amv :: from_static( "abc" ) , Amv :: from_static( "abc" ) ) ;
778
+ assert_ne ! ( Amv :: from_static( "abc" ) , Amv :: from_static( "ABC" ) ) ;
779
779
780
- assert_eq ! ( BMV :: from_bytes( b"abc" ) , BMV :: from_bytes( b"abc" ) ) ;
781
- assert_ne ! ( BMV :: from_bytes( b"abc" ) , BMV :: from_bytes( b"ABC" ) ) ;
780
+ assert_eq ! ( Bmv :: from_bytes( b"abc" ) , Bmv :: from_bytes( b"abc" ) ) ;
781
+ assert_ne ! ( Bmv :: from_bytes( b"abc" ) , Bmv :: from_bytes( b"ABC" ) ) ;
782
782
783
783
// Padding is ignored.
784
784
assert_eq ! (
785
- BMV :: from_static( "SGVsbG8hIQ==" ) ,
786
- BMV :: from_static( "SGVsbG8hIQ" )
785
+ Bmv :: from_static( "SGVsbG8hIQ==" ) ,
786
+ Bmv :: from_static( "SGVsbG8hIQ" )
787
787
) ;
788
788
// Invalid values are all just invalid from this point of view.
789
789
// SAFETY: metadata value is valid here
790
790
unsafe {
791
791
assert_eq ! (
792
- BMV :: from_shared_unchecked( Bytes :: from_static( b"..{}" ) ) ,
793
- BMV :: from_shared_unchecked( Bytes :: from_static( b"{}.." ) )
792
+ Bmv :: from_shared_unchecked( Bytes :: from_static( b"..{}" ) ) ,
793
+ Bmv :: from_shared_unchecked( Bytes :: from_static( b"{}.." ) )
794
794
) ;
795
795
}
796
796
}
797
797
798
798
#[ test]
799
799
fn test_value_eq_str ( ) {
800
- type BMV = BinaryMetadataValue ;
801
- type AMV = AsciiMetadataValue ;
800
+ type Bmv = BinaryMetadataValue ;
801
+ type Amv = AsciiMetadataValue ;
802
802
803
- assert_eq ! ( AMV :: from_static( "abc" ) , "abc" ) ;
804
- assert_ne ! ( AMV :: from_static( "abc" ) , "ABC" ) ;
805
- assert_eq ! ( "abc" , AMV :: from_static( "abc" ) ) ;
806
- assert_ne ! ( "ABC" , AMV :: from_static( "abc" ) ) ;
803
+ assert_eq ! ( Amv :: from_static( "abc" ) , "abc" ) ;
804
+ assert_ne ! ( Amv :: from_static( "abc" ) , "ABC" ) ;
805
+ assert_eq ! ( "abc" , Amv :: from_static( "abc" ) ) ;
806
+ assert_ne ! ( "ABC" , Amv :: from_static( "abc" ) ) ;
807
807
808
- assert_eq ! ( BMV :: from_bytes( b"abc" ) , "abc" ) ;
809
- assert_ne ! ( BMV :: from_bytes( b"abc" ) , "ABC" ) ;
810
- assert_eq ! ( "abc" , BMV :: from_bytes( b"abc" ) ) ;
811
- assert_ne ! ( "ABC" , BMV :: from_bytes( b"abc" ) ) ;
808
+ assert_eq ! ( Bmv :: from_bytes( b"abc" ) , "abc" ) ;
809
+ assert_ne ! ( Bmv :: from_bytes( b"abc" ) , "ABC" ) ;
810
+ assert_eq ! ( "abc" , Bmv :: from_bytes( b"abc" ) ) ;
811
+ assert_ne ! ( "ABC" , Bmv :: from_bytes( b"abc" ) ) ;
812
812
813
813
// Padding is ignored.
814
- assert_eq ! ( BMV :: from_static( "SGVsbG8hIQ==" ) , "Hello!!" ) ;
815
- assert_eq ! ( "Hello!!" , BMV :: from_static( "SGVsbG8hIQ==" ) ) ;
814
+ assert_eq ! ( Bmv :: from_static( "SGVsbG8hIQ==" ) , "Hello!!" ) ;
815
+ assert_eq ! ( "Hello!!" , Bmv :: from_static( "SGVsbG8hIQ==" ) ) ;
816
816
}
817
817
818
818
#[ test]
819
819
fn test_value_eq_bytes ( ) {
820
- type BMV = BinaryMetadataValue ;
821
- type AMV = AsciiMetadataValue ;
820
+ type Bmv = BinaryMetadataValue ;
821
+ type Amv = AsciiMetadataValue ;
822
822
823
- assert_eq ! ( AMV :: from_static( "abc" ) , "abc" . as_bytes( ) ) ;
824
- assert_ne ! ( AMV :: from_static( "abc" ) , "ABC" . as_bytes( ) ) ;
825
- assert_eq ! ( * "abc" . as_bytes( ) , AMV :: from_static( "abc" ) ) ;
826
- assert_ne ! ( * "ABC" . as_bytes( ) , AMV :: from_static( "abc" ) ) ;
823
+ assert_eq ! ( Amv :: from_static( "abc" ) , "abc" . as_bytes( ) ) ;
824
+ assert_ne ! ( Amv :: from_static( "abc" ) , "ABC" . as_bytes( ) ) ;
825
+ assert_eq ! ( * "abc" . as_bytes( ) , Amv :: from_static( "abc" ) ) ;
826
+ assert_ne ! ( * "ABC" . as_bytes( ) , Amv :: from_static( "abc" ) ) ;
827
827
828
- assert_eq ! ( * "abc" . as_bytes( ) , BMV :: from_bytes( b"abc" ) ) ;
829
- assert_ne ! ( * "ABC" . as_bytes( ) , BMV :: from_bytes( b"abc" ) ) ;
828
+ assert_eq ! ( * "abc" . as_bytes( ) , Bmv :: from_bytes( b"abc" ) ) ;
829
+ assert_ne ! ( * "ABC" . as_bytes( ) , Bmv :: from_bytes( b"abc" ) ) ;
830
830
831
831
// Padding is ignored.
832
- assert_eq ! ( BMV :: from_static( "SGVsbG8hIQ==" ) , "Hello!!" . as_bytes( ) ) ;
833
- assert_eq ! ( * "Hello!!" . as_bytes( ) , BMV :: from_static( "SGVsbG8hIQ==" ) ) ;
832
+ assert_eq ! ( Bmv :: from_static( "SGVsbG8hIQ==" ) , "Hello!!" . as_bytes( ) ) ;
833
+ assert_eq ! ( * "Hello!!" . as_bytes( ) , Bmv :: from_static( "SGVsbG8hIQ==" ) ) ;
834
834
}
835
835
836
836
#[ test]
837
837
fn test_ascii_value_hash ( ) {
838
838
use std:: collections:: hash_map:: DefaultHasher ;
839
- type AMV = AsciiMetadataValue ;
839
+ type Amv = AsciiMetadataValue ;
840
840
841
- fn hash ( value : AMV ) -> u64 {
841
+ fn hash ( value : Amv ) -> u64 {
842
842
let mut hasher = DefaultHasher :: new ( ) ;
843
843
value. hash ( & mut hasher) ;
844
844
hasher. finish ( )
845
845
}
846
846
847
- let value1 = AMV :: from_static ( "abc" ) ;
848
- let value2 = AMV :: from_static ( "abc" ) ;
847
+ let value1 = Amv :: from_static ( "abc" ) ;
848
+ let value2 = Amv :: from_static ( "abc" ) ;
849
849
assert_eq ! ( value1, value2) ;
850
850
assert_eq ! ( hash( value1) , hash( value2) ) ;
851
851
852
- let value1 = AMV :: from_static ( "abc" ) ;
853
- let value2 = AMV :: from_static ( "xyz" ) ;
852
+ let value1 = Amv :: from_static ( "abc" ) ;
853
+ let value2 = Amv :: from_static ( "xyz" ) ;
854
854
855
855
assert_ne ! ( value1, value2) ;
856
856
assert_ne ! ( hash( value1) , hash( value2) ) ;
@@ -859,48 +859,48 @@ fn test_ascii_value_hash() {
859
859
#[ test]
860
860
fn test_valid_binary_value_hash ( ) {
861
861
use std:: collections:: hash_map:: DefaultHasher ;
862
- type BMV = BinaryMetadataValue ;
862
+ type Bmv = BinaryMetadataValue ;
863
863
864
- fn hash ( value : BMV ) -> u64 {
864
+ fn hash ( value : Bmv ) -> u64 {
865
865
let mut hasher = DefaultHasher :: new ( ) ;
866
866
value. hash ( & mut hasher) ;
867
867
hasher. finish ( )
868
868
}
869
869
870
- let value1 = BMV :: from_bytes ( b"abc" ) ;
871
- let value2 = BMV :: from_bytes ( b"abc" ) ;
870
+ let value1 = Bmv :: from_bytes ( b"abc" ) ;
871
+ let value2 = Bmv :: from_bytes ( b"abc" ) ;
872
872
assert_eq ! ( value1, value2) ;
873
873
assert_eq ! ( hash( value1) , hash( value2) ) ;
874
874
875
- let value1 = BMV :: from_bytes ( b"abc" ) ;
876
- let value2 = BMV :: from_bytes ( b"xyz" ) ;
875
+ let value1 = Bmv :: from_bytes ( b"abc" ) ;
876
+ let value2 = Bmv :: from_bytes ( b"xyz" ) ;
877
877
assert_ne ! ( value1, value2) ;
878
878
assert_ne ! ( hash( value1) , hash( value2) ) ;
879
879
}
880
880
881
881
#[ test]
882
882
fn test_invalid_binary_value_hash ( ) {
883
883
use std:: collections:: hash_map:: DefaultHasher ;
884
- type BMV = BinaryMetadataValue ;
884
+ type Bmv = BinaryMetadataValue ;
885
885
886
- fn hash ( value : BMV ) -> u64 {
886
+ fn hash ( value : Bmv ) -> u64 {
887
887
let mut hasher = DefaultHasher :: new ( ) ;
888
888
value. hash ( & mut hasher) ;
889
889
hasher. finish ( )
890
890
}
891
891
892
892
// SAFETY: metadata value is valid here
893
893
unsafe {
894
- let value1 = BMV :: from_shared_unchecked ( Bytes :: from_static ( b"..{}" ) ) ;
895
- let value2 = BMV :: from_shared_unchecked ( Bytes :: from_static ( b"{}.." ) ) ;
894
+ let value1 = Bmv :: from_shared_unchecked ( Bytes :: from_static ( b"..{}" ) ) ;
895
+ let value2 = Bmv :: from_shared_unchecked ( Bytes :: from_static ( b"{}.." ) ) ;
896
896
assert_eq ! ( value1, value2) ;
897
897
assert_eq ! ( hash( value1) , hash( value2) ) ;
898
898
}
899
899
900
900
// SAFETY: metadata value is valid here
901
901
unsafe {
902
- let valid = BMV :: from_bytes ( b"abc" ) ;
903
- let invalid = BMV :: from_shared_unchecked ( Bytes :: from_static ( b"{}.." ) ) ;
902
+ let valid = Bmv :: from_bytes ( b"abc" ) ;
903
+ let invalid = Bmv :: from_shared_unchecked ( Bytes :: from_static ( b"{}.." ) ) ;
904
904
assert_ne ! ( valid, invalid) ;
905
905
assert_ne ! ( hash( valid) , hash( invalid) ) ;
906
906
}
0 commit comments