@@ -247,15 +247,17 @@ impl Keyring {
247
247
)
248
248
} ) ?;
249
249
unsafe { buffer. set_len ( ( actual_sz as usize ) / mem:: size_of :: < KeyringSerial > ( ) ) } ;
250
- let keys = buffer. iter ( )
250
+ let keys = buffer
251
+ . iter ( )
251
252
. map ( |& id| Key :: new_impl ( id) )
252
253
. partition ( |key| key. description ( ) . unwrap ( ) . type_ == "keyring" ) ;
253
254
Ok ( (
254
255
keys. 1 ,
255
256
keys. 0
256
- . iter ( )
257
- . map ( |key| Keyring :: new_impl ( key. id ) )
258
- . collect :: < Vec < _ > > ( ) ) )
257
+ . iter ( )
258
+ . map ( |key| Keyring :: new_impl ( key. id ) )
259
+ . collect :: < Vec < _ > > ( ) ,
260
+ ) )
259
261
}
260
262
261
263
/// Attach the persistent keyring for the current user to the current keyring.
@@ -786,7 +788,9 @@ mod tests {
786
788
// Create the key.
787
789
let description = "test:rust-keyutils:add_key" ;
788
790
let payload = "payload" ;
789
- let key = keyring. add_key :: < keytypes:: User , _ , _ > ( description, payload. as_bytes ( ) ) . unwrap ( ) ;
791
+ let key = keyring
792
+ . add_key :: < keytypes:: User , _ , _ > ( description, payload. as_bytes ( ) )
793
+ . unwrap ( ) ;
790
794
assert_eq ! (
791
795
key. read( ) . unwrap( ) ,
792
796
payload. as_bytes( ) . iter( ) . cloned( ) . collect:: <Vec <_>>( )
@@ -806,7 +810,12 @@ mod tests {
806
810
assert_eq ! ( keyrings. len( ) , 0 ) ;
807
811
808
812
// Create a key.
809
- keyring. add_key :: < keytypes:: User , _ , _ > ( "test:rust-keyutils:clear_keyring" , "payload" . as_bytes ( ) ) . unwrap ( ) ;
813
+ keyring
814
+ . add_key :: < keytypes:: User , _ , _ > (
815
+ "test:rust-keyutils:clear_keyring" ,
816
+ "payload" . as_bytes ( ) ,
817
+ )
818
+ . unwrap ( ) ;
810
819
keyring. add_keyring ( "description" ) . unwrap ( ) ;
811
820
812
821
let ( keys, keyrings) = keyring. read ( ) . unwrap ( ) ;
@@ -831,7 +840,9 @@ mod tests {
831
840
// Create the key.
832
841
let desc = "test:rust-keyutils:describe_key" ;
833
842
let payload = "payload" ;
834
- let key = keyring. add_key :: < keytypes:: User , _ , _ > ( desc, payload. as_bytes ( ) ) . unwrap ( ) ;
843
+ let key = keyring
844
+ . add_key :: < keytypes:: User , _ , _ > ( desc, payload. as_bytes ( ) )
845
+ . unwrap ( ) ;
835
846
836
847
// Check its description.
837
848
let description = key. description ( ) . unwrap ( ) ;
@@ -850,7 +861,9 @@ mod tests {
850
861
// Create the key.
851
862
let description = "test:rust-keyutils:invalidate_key" ;
852
863
let payload = "payload" ;
853
- let key = keyring. add_key :: < keytypes:: User , _ , _ > ( description, payload. as_bytes ( ) ) . unwrap ( ) ;
864
+ let key = keyring
865
+ . add_key :: < keytypes:: User , _ , _ > ( description, payload. as_bytes ( ) )
866
+ . unwrap ( ) ;
854
867
key. invalidate ( ) . unwrap ( ) ;
855
868
856
869
let ( keys, keyrings) = keyring. read ( ) . unwrap ( ) ;
@@ -888,7 +901,12 @@ mod tests {
888
901
assert_eq ! ( keys. len( ) , 0 ) ;
889
902
assert_eq ! ( keyrings. len( ) , 0 ) ;
890
903
891
- let key = keyring. add_key :: < keytypes:: User , _ , _ > ( "test:rust-keyutils:read_keyring" , "payload" . as_bytes ( ) ) . unwrap ( ) ;
904
+ let key = keyring
905
+ . add_key :: < keytypes:: User , _ , _ > (
906
+ "test:rust-keyutils:read_keyring" ,
907
+ "payload" . as_bytes ( ) ,
908
+ )
909
+ . unwrap ( ) ;
892
910
893
911
let ( keys, keyrings) = keyring. read ( ) . unwrap ( ) ;
894
912
assert_eq ! ( keys. len( ) , 1 ) ;
@@ -907,7 +925,9 @@ mod tests {
907
925
// Create the key.
908
926
let description = "test:rust-keyutils:read_key" ;
909
927
let payload = "payload" ;
910
- let key = keyring. add_key :: < keytypes:: User , _ , _ > ( description, payload. as_bytes ( ) ) . unwrap ( ) ;
928
+ let key = keyring
929
+ . add_key :: < keytypes:: User , _ , _ > ( description, payload. as_bytes ( ) )
930
+ . unwrap ( ) ;
911
931
assert_eq ! (
912
932
key. read( ) . unwrap( ) ,
913
933
payload. as_bytes( ) . iter( ) . cloned( ) . collect:: <Vec <_>>( )
@@ -963,7 +983,9 @@ mod tests {
963
983
// Create the key.
964
984
let description = "test:rust-keyutils:request_key" ;
965
985
let payload = "payload" ;
966
- let key = keyring. add_key :: < keytypes:: User , _ , _ > ( description, payload. as_bytes ( ) ) . unwrap ( ) ;
986
+ let key = keyring
987
+ . add_key :: < keytypes:: User , _ , _ > ( description, payload. as_bytes ( ) )
988
+ . unwrap ( ) ;
967
989
968
990
let found_key = keyring. request_key ( description) . unwrap ( ) ;
969
991
assert_eq ! ( found_key, key) ;
@@ -980,7 +1002,9 @@ mod tests {
980
1002
// Create the key.
981
1003
let description = "test:rust-keyutils:revoke_key" ;
982
1004
let payload = "payload" ;
983
- let key = keyring. add_key :: < keytypes:: User , _ , _ > ( description, payload. as_bytes ( ) ) . unwrap ( ) ;
1005
+ let key = keyring
1006
+ . add_key :: < keytypes:: User , _ , _ > ( description, payload. as_bytes ( ) )
1007
+ . unwrap ( ) ;
984
1008
let key_copy = key. clone ( ) ;
985
1009
986
1010
key. revoke ( ) . unwrap ( ) ;
@@ -1002,7 +1026,9 @@ mod tests {
1002
1026
// Create the key.
1003
1027
let description = "test:rust-keyutils:search_key" ;
1004
1028
let payload = "payload" ;
1005
- let key = new_inner_keyring. add_key :: < keytypes:: User , _ , _ > ( description, payload. as_bytes ( ) ) . unwrap ( ) ;
1029
+ let key = new_inner_keyring
1030
+ . add_key :: < keytypes:: User , _ , _ > ( description, payload. as_bytes ( ) )
1031
+ . unwrap ( ) ;
1006
1032
1007
1033
let found_key = keyring. search_for_key ( description) . unwrap ( ) ;
1008
1034
assert_eq ! ( found_key, key) ;
@@ -1021,7 +1047,9 @@ mod tests {
1021
1047
// Create the key.
1022
1048
let description = "test:rust-keyutils:key_timeout" ;
1023
1049
let payload = "payload" ;
1024
- let mut key = keyring. add_key :: < keytypes:: User , _ , _ > ( description, payload. as_bytes ( ) ) . unwrap ( ) ;
1050
+ let mut key = keyring
1051
+ . add_key :: < keytypes:: User , _ , _ > ( description, payload. as_bytes ( ) )
1052
+ . unwrap ( ) ;
1025
1053
1026
1054
// Set the timeout on the key.
1027
1055
let duration = Duration :: from_secs ( 1 ) ;
@@ -1074,7 +1102,9 @@ mod tests {
1074
1102
// Create the key.
1075
1103
let description = "test:rust-keyutils:unlink_key" ;
1076
1104
let payload = "payload" ;
1077
- let key = keyring. add_key :: < keytypes:: User , _ , _ > ( description, payload. as_bytes ( ) ) . unwrap ( ) ;
1105
+ let key = keyring
1106
+ . add_key :: < keytypes:: User , _ , _ > ( description, payload. as_bytes ( ) )
1107
+ . unwrap ( ) ;
1078
1108
1079
1109
let ( keys, keyrings) = keyring. read ( ) . unwrap ( ) ;
1080
1110
assert_eq ! ( keys. len( ) , 1 ) ;
@@ -1102,11 +1132,15 @@ mod tests {
1102
1132
// Create the key.
1103
1133
let description = "test:rust-keyutils:update_key" ;
1104
1134
let payload = "payload" ;
1105
- let key = keyring. add_key :: < keytypes:: User , _ , _ > ( description, payload. as_bytes ( ) ) . unwrap ( ) ;
1135
+ let key = keyring
1136
+ . add_key :: < keytypes:: User , _ , _ > ( description, payload. as_bytes ( ) )
1137
+ . unwrap ( ) ;
1106
1138
1107
1139
// Update the key.
1108
1140
let new_payload = "new_payload" ;
1109
- let updated_key = keyring. add_key :: < keytypes:: User , _ , _ > ( description, new_payload. as_bytes ( ) ) . unwrap ( ) ;
1141
+ let updated_key = keyring
1142
+ . add_key :: < keytypes:: User , _ , _ > ( description, new_payload. as_bytes ( ) )
1143
+ . unwrap ( ) ;
1110
1144
assert_eq ! ( key, updated_key) ;
1111
1145
assert_eq ! (
1112
1146
updated_key. read( ) . unwrap( ) ,
0 commit comments