Crates.io | must_be_empty |
lib.rs | must_be_empty |
version | 0.1.1 |
source | src |
created_at | 2022-12-28 00:59:02.969235 |
updated_at | 2023-01-01 12:23:17.661773 |
description | Makes sure that an specific function is empty. With no statements |
homepage | |
repository | https://github.com/blyxyas/must_be_empty |
max_upload_size | |
id | 746571 |
size | 4,926 |
This attribute checks that a given function is empty. It is just that.
This can be useful for debugging, when you're just using using cargo test
and want to assure that nobody in a repository puts content in the main function, for example.
use must_be_empty::must_be_empty;
#[must_be_empty]
fn main() {}
If you were to put something in that main
function, it would give a warning or an error, depending on your configuration.
Put this in your Cargo.toml
file:
[dependencies]
must_be_empty = "0.1.0"
warn
(Default): Warns, instead of outputing a hard-error.only_on_release
: Only works in release mode (--release
)only_on_debug
: Only works in debug mode.