diff --git a/README.md b/README.md index 93e94ea9..8988d54d 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ fn add(a: i64, b: i64) -> i64 { a + b } -rustler::init!("Elixir.Math", [add]); +rustler::init!("Elixir.Math"); ``` #### Minimal Supported Rust Version (MSRV) diff --git a/rustler/src/serde/mod.rs b/rustler/src/serde/mod.rs index 3063036d..fbb6f5bd 100644 --- a/rustler/src/serde/mod.rs +++ b/rustler/src/serde/mod.rs @@ -12,7 +12,7 @@ in a better way and allow more Erlang-y configurations). use rustler::{self, Encoder, SerdeTerm}; use serde::{Serialize, Deserialize}; -rustler::init!("Elixir.SerdeNif", [readme]); +rustler::init!("Elixir.SerdeNif"); // NOTE: to serialize to the correct Elixir record, you MUST tell serde to // rename the variants to the full Elixir record module atom. diff --git a/rustler_benchmarks/native/benchmark/src/lib.rs b/rustler_benchmarks/native/benchmark/src/lib.rs index 2589025a..6faa5abd 100644 --- a/rustler_benchmarks/native/benchmark/src/lib.rs +++ b/rustler_benchmarks/native/benchmark/src/lib.rs @@ -2,19 +2,4 @@ mod nif_record; mod nif_struct; mod nif_various; -rustler::init!( - "Elixir.Benchmark", - [ - nif_struct::benchmark, - nif_record::benchmark, - nif_various::encode_tagged_enum, - nif_various::decode_tagged_enum, - nif_various::decode_struct, - nif_various::decode_struct_string, - nif_various::decode_string, - nif_various::decode_term, - nif_various::void, - nif_various::encode_atom, - nif_various::compare_atom - ] -); +rustler::init!("Elixir.Benchmark"); diff --git a/rustler_codegen/src/lib.rs b/rustler_codegen/src/lib.rs index 5c012826..8bace2f9 100644 --- a/rustler_codegen/src/lib.rs +++ b/rustler_codegen/src/lib.rs @@ -50,7 +50,7 @@ enum RustlerAttr { /// true /// } /// -/// rustler::init!("Elixir.Math", [add, sub, mul, div], load = load); +/// rustler::init!("Elixir.Math", load = load); /// ``` #[proc_macro] pub fn init(input: TokenStream) -> TokenStream { diff --git a/rustler_mix/priv/templates/basic/src/lib.rs b/rustler_mix/priv/templates/basic/src/lib.rs index 923cf822..ed15b802 100644 --- a/rustler_mix/priv/templates/basic/src/lib.rs +++ b/rustler_mix/priv/templates/basic/src/lib.rs @@ -3,4 +3,4 @@ fn add(a: i64, b: i64) -> i64 { a + b } -rustler::init!("<%= native_module %>", [add]); +rustler::init!("<%= native_module %>"); diff --git a/rustler_tests/native/dynamic_load/src/lib.rs b/rustler_tests/native/dynamic_load/src/lib.rs index 03325a40..e579e72b 100644 --- a/rustler_tests/native/dynamic_load/src/lib.rs +++ b/rustler_tests/native/dynamic_load/src/lib.rs @@ -52,4 +52,4 @@ fn build_path_buf(priv_path: &[u8]) -> PathBuf { PathBuf::from(priv_path) } -rustler::init!("Elixir.DynamicData", [get_dataset], load = load); +rustler::init!("Elixir.DynamicData", load = load); diff --git a/rustler_tests/native/rustler_bigint_test/src/lib.rs b/rustler_tests/native/rustler_bigint_test/src/lib.rs index 99e29f4e..96121e29 100644 --- a/rustler_tests/native/rustler_bigint_test/src/lib.rs +++ b/rustler_tests/native/rustler_bigint_test/src/lib.rs @@ -15,4 +15,4 @@ pub fn add(a: BigInt, b: BigInt) -> NifResult { Ok(a.checked_add(&b).unwrap()) } -rustler::init!("Elixir.RustlerBigintTest", [echo, add_one, add]); +rustler::init!("Elixir.RustlerBigintTest"); diff --git a/rustler_tests/native/rustler_test/src/lib.rs b/rustler_tests/native/rustler_test/src/lib.rs index 7a64fde6..0c151dbc 100644 --- a/rustler_tests/native/rustler_test/src/lib.rs +++ b/rustler_tests/native/rustler_test/src/lib.rs @@ -16,101 +16,8 @@ mod test_term; mod test_thread; mod test_tuple; -rustler::init!( - "Elixir.RustlerTest", - [ - test_primitives::add_u32, - test_primitives::add_i32, - test_primitives::echo_u8, - test_primitives::option_inc, - test_primitives::erlang_option_inc, - test_primitives::result_to_int, - test_primitives::echo_u128, - test_primitives::echo_i128, - test_list::sum_list, - test_list::make_list, - test_local_pid::compare_local_pids, - test_local_pid::are_equal_local_pids, - test_term::term_debug, - test_term::term_eq, - test_term::term_cmp, - test_term::term_internal_hash, - test_term::term_phash2_hash, - test_term::term_type, - test_map::sum_map_values, - test_map::map_entries, - test_map::map_entries_reversed, - test_map::map_from_arrays, - test_map::map_from_pairs, - test_map::map_generic, - test_resource::resource_make, - test_resource::resource_set_integer_field, - test_resource::resource_get_integer_field, - test_resource::resource_make_immutable, - test_resource::resource_immutable_count, - test_resource::resource_make_with_binaries, - test_resource::resource_make_binaries, - test_atom::atom_to_string, - test_atom::atom_equals_ok, - test_atom::binary_to_atom, - test_atom::binary_to_existing_atom, - test_binary::make_shorter_subbinary, - test_binary::parse_integer, - test_binary::binary_new, - test_binary::owned_binary_new, - test_binary::new_binary_new, - test_binary::unowned_to_owned, - test_binary::realloc_shrink, - test_binary::realloc_grow, - test_binary::encode_string, - test_binary::decode_iolist, - test_thread::threaded_fac, - test_thread::threaded_sleep, - test_env::send_all, - test_env::send, - test_env::whereis_pid, - test_env::is_process_alive, - test_env::sublists, - test_codegen::tuple_echo, - test_codegen::record_echo, - test_codegen::map_echo, - test_codegen::exception_echo, - test_codegen::struct_echo, - test_codegen::unit_enum_echo, - test_codegen::tagged_enum_1_echo, - test_codegen::tagged_enum_2_echo, - test_codegen::tagged_enum_3_echo, - test_codegen::tagged_enum_4_echo, - test_codegen::untagged_enum_echo, - test_codegen::untagged_enum_with_truthy, - test_codegen::untagged_enum_for_issue_370, - test_codegen::newtype_echo, - test_codegen::tuplestruct_echo, - test_codegen::newtype_record_echo, - test_codegen::tuplestruct_record_echo, - test_dirty::dirty_cpu, - test_dirty::dirty_io, - test_range::sum_range, - test_error::bad_arg_error, - test_error::atom_str_error, - test_error::raise_atom_error, - test_error::raise_term_with_string_error, - test_error::raise_term_with_atom_error, - test_error::term_with_tuple_error, - test_nif_attrs::can_rename, - test_tuple::add_from_tuple, - test_tuple::add_one_to_tuple, - test_tuple::join_tuple_elements, - test_tuple::maybe_add_one_to_tuple, - test_tuple::add_i32_from_tuple, - test_tuple::greeting_person_from_tuple, - test_codegen::reserved_keywords::reserved_keywords_type_echo, - test_codegen::generic_types::generic_struct_echo, - test_codegen::generic_types::mk_generic_map, - test_path::append_to_path, - ], - load = load -); +// Intentional usage of the explicit form (in an "invalid" way, listing a wrong set of functions) to ensure that the warning stays alive +rustler::init!("Elixir.RustlerTest", [deprecated, usage], load = load); fn load(env: rustler::Env, _: rustler::Term) -> bool { test_resource::on_load(env);