error_utils/
fail.rs

1// SPDX-License-Identifier: MIT
2//
3// Copyright (c) 2022 Robert Oleynik
4
5/// Shorthand for [`std::process::exit`]
6///
7/// # Usage
8///
9/// ```rust
10/// fail!();
11/// // Shorthand for
12/// std::process::exit(1);
13/// ```
14///
15/// or
16///
17/// ```rust
18/// fail!(/* exit code */);
19/// // Shorthand for
20/// std::process::exit(/* exit code */);
21/// ```
22#[macro_export]
23macro_rules! fail {
24	() => {
25		::std::process::exit(1)
26	};
27	( $code:expr ) => {
28		::std::process::exit($code)
29	};
30}