From f4e2abc85516ad2dfa6183ef281e3b6824acb0c1 Mon Sep 17 00:00:00 2001 From: Bruno Deferrari Date: Sun, 28 Jan 2024 11:16:27 -0300 Subject: [PATCH] Fix clippy warnings --- src/compile_ok_tests.rs | 4 ++-- src/memory.rs | 12 ++++++------ src/runtime.rs | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/compile_ok_tests.rs b/src/compile_ok_tests.rs index 5d8c49b..7fee57d 100644 --- a/src/compile_ok_tests.rs +++ b/src/compile_ok_tests.rs @@ -29,7 +29,7 @@ mod test_immediate_ocamlrefs { #[test] fn test_immediate_ocamlrefs() { - let mut cr = unsafe { OCamlRuntime::recover_handle() }; - assert!(test_immediate_ocamlref(&mut cr)); + let cr = unsafe { OCamlRuntime::recover_handle() }; + assert!(test_immediate_ocamlref(cr)); } } diff --git a/src/memory.rs b/src/memory.rs index 4bff650..480dace 100644 --- a/src/memory.rs +++ b/src/memory.rs @@ -92,9 +92,9 @@ pub fn alloc_double(cr: &mut OCamlRuntime, d: f64) -> OCaml { // small values (like tuples and conses are) without going through `caml_modify` to get // a little bit of extra performance. -pub fn alloc_some<'a, 'b, A>( +pub fn alloc_some<'a, A>( cr: &'a mut OCamlRuntime, - value: OCamlRef<'b, A>, + value: OCamlRef<'_, A>, ) -> OCaml<'a, Option> { unsafe { let ocaml_some = caml_alloc(1, tag::SOME); @@ -103,9 +103,9 @@ pub fn alloc_some<'a, 'b, A>( } } -pub fn alloc_ok<'a, 'b, A, Err>( +pub fn alloc_ok<'a, A, Err>( cr: &'a mut OCamlRuntime, - value: OCamlRef<'b, A>, + value: OCamlRef<'_, A>, ) -> OCaml<'a, Result> { unsafe { let ocaml_ok = caml_alloc(1, tag::TAG_OK); @@ -114,9 +114,9 @@ pub fn alloc_ok<'a, 'b, A, Err>( } } -pub fn alloc_error<'a, 'b, A, Err>( +pub fn alloc_error<'a, A, Err>( cr: &'a mut OCamlRuntime, - err: OCamlRef<'b, Err>, + err: OCamlRef<'_, Err>, ) -> OCaml<'a, Result> { unsafe { let ocaml_err = caml_alloc(1, tag::TAG_ERROR); diff --git a/src/runtime.rs b/src/runtime.rs index b74542f..95a659d 100644 --- a/src/runtime.rs +++ b/src/runtime.rs @@ -35,7 +35,7 @@ impl OCamlRuntime { INIT.call_once(|| { let arg0 = "ocaml\0".as_ptr() as *const ocaml_sys::Char; - let c_args = vec![arg0, core::ptr::null()]; + let c_args = [arg0, core::ptr::null()]; unsafe { ocaml_sys::caml_startup(c_args.as_ptr()); }