Skip to main content

noop_returns

Attribute Macro noop_returns 

Source
#[noop_returns]
Expand description

Makes the tagged function/method a no-op that returns the given expression.

#[noop_returns(EXPR)] replaces the function or method body with { EXPR }. It can be applied to:

  • a free function or a single method, whose body becomes { EXPR }, or
  • an entire impl block, where every method returns EXPR, except for methods carrying their own #[noop_returns(OTHER)], which return OTHER.

Applying it to anything else is an error.

Inside a #[make_noop] impl block this attribute overrides the default Default::default() return for that method; used anywhere else it stands on its own.