From 5b7f0f10dc5b5d9f586cee3ed332b71a5840fa5b Mon Sep 17 00:00:00 2001 From: Brandon Fish Date: Sat, 15 Dec 2018 00:06:47 -0600 Subject: [PATCH 1/5] Fix clippy redundant field names in struct initialization --- src/webassembly/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/webassembly/mod.rs b/src/webassembly/mod.rs index 4e8c92b88..7a002d8fa 100644 --- a/src/webassembly/mod.rs +++ b/src/webassembly/mod.rs @@ -67,9 +67,9 @@ pub fn instantiate( mock_missing_imports: false, mock_missing_globals: false, mock_missing_tables: false, - abi: abi, + abi, show_progressbar: false, - isa: isa, + isa, }); debug!("webassembly - creating instance"); From d405d8de414ee749023387fb1cfa1b01263a5466 Mon Sep 17 00:00:00 2001 From: Brandon Fish Date: Sat, 15 Dec 2018 00:07:14 -0600 Subject: [PATCH 2/5] Fix clippy warnings unneeded returns --- src/webassembly/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/webassembly/mod.rs b/src/webassembly/mod.rs index 7a002d8fa..31eb4d979 100644 --- a/src/webassembly/mod.rs +++ b/src/webassembly/mod.rs @@ -229,7 +229,7 @@ pub fn start_instance(module: &Module, instance: &mut Instance, path: &str, args let (argc, argv) = store_module_arguments(path, args, instance); - return call_protected!(main(argc, argv, &instance)).map_err(|err| format!("{}", err)); + call_protected!(main(argc, argv, &instance)).map_err(|err| format!("{}", err)) // TODO: We should implement emscripten __ATEXIT__ } else { let func_index = @@ -241,6 +241,6 @@ pub fn start_instance(module: &Module, instance: &mut Instance, path: &str, args }); let main: extern "C" fn(&Instance) = get_instance_function!(instance, func_index); - return call_protected!(main(&instance)).map_err(|err| format!("{}", err)); + call_protected!(main(&instance)).map_err(|err| format!("{}", err)) } } From aa7fc05ea18822b2507f364e55cbe3bf01192240 Mon Sep 17 00:00:00 2001 From: Brandon Fish Date: Sat, 15 Dec 2018 00:10:07 -0600 Subject: [PATCH 3/5] Fix clippy warning length comparison to one --- src/webassembly/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/webassembly/mod.rs b/src/webassembly/mod.rs index 31eb4d979..0c78de8a7 100644 --- a/src/webassembly/mod.rs +++ b/src/webassembly/mod.rs @@ -159,7 +159,7 @@ fn store_module_arguments(path: &str, args: Vec<&str>, instance: &mut Instance) let argc = args.len() + 1; let (argv_offset, argv_slice): (_, &mut [u32]) = unsafe { allocate_on_stack(((argc + 1) * 4) as u32, instance) }; - assert!(argv_slice.len() >= 1); + assert!(!argv_slice.is_empty()); argv_slice[0] = unsafe { allocate_cstr_on_stack(path, instance).0 }; From 9971c21d74f6f5216020979cf80ee5018021082d Mon Sep 17 00:00:00 2001 From: Brandon Fish Date: Sat, 15 Dec 2018 00:11:32 -0600 Subject: [PATCH 4/5] Fix clippy error equal expressions as operands to `-` --- src/webassembly/utils.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/webassembly/utils.rs b/src/webassembly/utils.rs index c6d63fad3..012160f86 100644 --- a/src/webassembly/utils.rs +++ b/src/webassembly/utils.rs @@ -48,7 +48,7 @@ instance.data_pointers.globals \t- {:X} | offset - {:?} memories_pointer_address_0, 0, memories_pointer_address_0_data, - memories_pointer_address_0_data - memories_pointer_address_0_data, + memories_pointer_address_0_data - instance_address, globals_pointer_address, globals_pointer_address - instance_address, ); From c6957a62872ebaa094831c89ceaf0ae909e4761c Mon Sep 17 00:00:00 2001 From: Brandon Fish Date: Sat, 15 Dec 2018 01:17:55 -0600 Subject: [PATCH 5/5] Run cargo fmt to clean up --- src/webassembly/mod.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/webassembly/mod.rs b/src/webassembly/mod.rs index a94150d88..5c679ba48 100644 --- a/src/webassembly/mod.rs +++ b/src/webassembly/mod.rs @@ -231,7 +231,7 @@ pub fn start_instance( let (argc, argv) = store_module_arguments(path, args, instance); call_protected!(main(argc, argv, &instance)).map_err(|err| format!("{}", err)) - // TODO: We should implement emscripten __ATEXIT__ + // TODO: We should implement emscripten __ATEXIT__ } else { let func_index = instance @@ -240,8 +240,7 @@ pub fn start_instance( Some(&Export::Function(index)) => index, _ => panic!("Main function not found"), }); - let main: extern "C" fn(&Instance) = - get_instance_function!(instance, func_index); + let main: extern "C" fn(&Instance) = get_instance_function!(instance, func_index); call_protected!(main(&instance)).map_err(|err| format!("{}", err)) } }