Skip to content

if_test!() macro #8130

Closed
Closed
@bblum

Description

@bblum

Often I find myself writing code such as:

#[cfg(test)]
fn assert_something_expensive() { ... }
#[cfg(not(test))]
fn assert_something_expensive() { return; }

Sometimes this is logic that is not just an assert, in the case of rt::comm::block_on(). I wish for a macro so this could be done more concisely without needing to define clunky new function items.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-attributesArea: Attributes (`#[…]`, `#![…]`)A-syntaxextArea: Syntax extensions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions