11use crate :: config;
2- use std:: collections:: hash_map ;
2+ use std:: collections:: HashMap ;
33use std:: env:: consts:: ARCH ;
44use std:: fs;
55use std:: sync:: Arc ;
@@ -66,7 +66,7 @@ const RESOURCE_KEY: &str = "resource";
6666
6767#[ derive( Debug , Clone ) ]
6868pub struct Lambda {
69- tags_map : hash_map :: HashMap < String , String > ,
69+ tags_map : HashMap < String , String > ,
7070}
7171
7272fn arch_to_platform < ' a > ( ) -> & ' a str {
@@ -77,10 +77,10 @@ fn arch_to_platform<'a>() -> &'a str {
7777}
7878
7979fn tags_from_env (
80- mut tags_map : hash_map :: HashMap < String , String > ,
80+ mut tags_map : HashMap < String , String > ,
8181 config : Arc < config:: Config > ,
82- metadata : & hash_map :: HashMap < String , String > ,
83- ) -> hash_map :: HashMap < String , String > {
82+ metadata : & HashMap < String , String > ,
83+ ) -> HashMap < String , String > {
8484 if metadata. contains_key ( FUNCTION_ARN_KEY ) {
8585 let parts = metadata[ FUNCTION_ARN_KEY ] . split ( ':' ) . collect :: < Vec < & str > > ( ) ;
8686 if parts. len ( ) > 6 {
@@ -222,10 +222,10 @@ impl Lambda {
222222 #[ must_use]
223223 pub fn new_from_config (
224224 config : Arc < config:: Config > ,
225- metadata : & hash_map :: HashMap < String , String > ,
225+ metadata : & HashMap < String , String > ,
226226 ) -> Self {
227227 Lambda {
228- tags_map : tags_from_env ( hash_map :: HashMap :: new ( ) , config, metadata) ,
228+ tags_map : tags_from_env ( HashMap :: new ( ) , config, metadata) ,
229229 }
230230 }
231231
@@ -248,19 +248,19 @@ impl Lambda {
248248 }
249249
250250 #[ must_use]
251- pub fn get_tags_map ( & self ) -> & hash_map :: HashMap < String , String > {
251+ pub fn get_tags_map ( & self ) -> & HashMap < String , String > {
252252 & self . tags_map
253253 }
254254
255255 #[ must_use]
256- pub fn get_function_tags_map ( & self ) -> hash_map :: HashMap < String , String > {
256+ pub fn get_function_tags_map ( & self ) -> HashMap < String , String > {
257257 let tags = self
258258 . tags_map
259259 . iter ( )
260260 . map ( |( k, v) | format ! ( "{k}:{v}" ) )
261261 . collect :: < Vec < String > > ( )
262262 . join ( "," ) ;
263- hash_map :: HashMap :: from_iter ( [ ( FUNCTION_TAGS_KEY . to_string ( ) , tags) ] )
263+ HashMap :: from_iter ( [ ( FUNCTION_TAGS_KEY . to_string ( ) , tags) ] )
264264 }
265265}
266266
@@ -270,13 +270,14 @@ mod tests {
270270 use super :: * ;
271271 use crate :: config:: Config ;
272272 use serial_test:: serial;
273+ use std:: collections:: HashMap ;
273274 use std:: fs:: File ;
274275 use std:: io:: Write ;
275276 use std:: path:: Path ;
276277
277278 #[ test]
278279 fn test_new_from_config ( ) {
279- let metadata = hash_map :: HashMap :: new ( ) ;
280+ let metadata = HashMap :: new ( ) ;
280281 let tags = Lambda :: new_from_config ( Arc :: new ( Config :: default ( ) ) , & metadata) ;
281282 assert_eq ! ( tags. tags_map. len( ) , 3 ) ;
282283 assert_eq ! (
@@ -297,7 +298,7 @@ mod tests {
297298
298299 #[ test]
299300 fn test_new_with_function_arn_metadata ( ) {
300- let mut metadata = hash_map :: HashMap :: new ( ) ;
301+ let mut metadata = HashMap :: new ( ) ;
301302 metadata. insert (
302303 FUNCTION_ARN_KEY . to_string ( ) ,
303304 "arn:aws:lambda:us-west-2:123456789012:function:my-function" . to_string ( ) ,
@@ -317,7 +318,7 @@ mod tests {
317318 #[ test]
318319 #[ serial] //run test serially since it sets and unsets env vars
319320 fn test_with_lambda_env_vars ( ) {
320- let mut metadata = hash_map :: HashMap :: new ( ) ;
321+ let mut metadata = HashMap :: new ( ) ;
321322 metadata. insert (
322323 FUNCTION_ARN_KEY . to_string ( ) ,
323324 "arn:aws:lambda:us-west-2:123456789012:function:My-function" . to_string ( ) ,
@@ -387,7 +388,7 @@ mod tests {
387388
388389 #[ test]
389390 fn test_get_function_tags_map ( ) {
390- let mut metadata = hash_map :: HashMap :: new ( ) ;
391+ let mut metadata = HashMap :: new ( ) ;
391392 metadata. insert (
392393 FUNCTION_ARN_KEY . to_string ( ) ,
393394 "arn:aws:lambda:us-west-2:123456789012:function:my-function" . to_string ( ) ,
@@ -402,7 +403,7 @@ mod tests {
402403 let tags = Lambda :: new_from_config ( config, & metadata) ;
403404 let function_tags = tags. get_function_tags_map ( ) ;
404405 assert_eq ! ( function_tags. len( ) , 1 ) ;
405- let fn_tags_map: hash_map :: HashMap < String , String > = function_tags
406+ let fn_tags_map: HashMap < String , String > = function_tags
406407 . get ( FUNCTION_TAGS_KEY )
407408 . unwrap ( )
408409 . split ( ',' )
0 commit comments