mutants/lib.rs
1// Copyright 2021 Martin Pool
2
3//! Attribute macros to control how [cargo-mutants](https://crates.io/crates/cargo-mutants) mutates code.
4//!
5//! For example, a function that is difficult to test, or has disruptive effects when mutated, can
6//! be marked with [macro@skip].
7//!
8//! # Changelog
9//!
10//! ## 0.0.3
11//!
12//! * Reset edition to 2018 for broader compatibility.
13
14use proc_macro::TokenStream;
15
16/// `cargo mutants` should not mutate functions marked with this attribute.
17///
18/// This can currently only be applied to functions, not modules or other syntactic constructs.
19///
20/// ```
21/// #[mutants::skip]
22/// pub fn some_difficult_function() {
23/// // ...
24/// }
25/// ```
26///
27/// This is a no-op during compilation, but is seen by cargo-mutants as it processes the source.
28#[proc_macro_attribute]
29pub fn skip(_attr: TokenStream, item: TokenStream) -> TokenStream {
30 item
31}