Coverage Report

Created: 2025-02-25 06:39

/rust/registry/src/index.crates.io-6f17d22bba15001f/criterion-0.5.1/src/macros_private.rs
Line
Count
Source (jump to first uncovered line)
1
//! Private macro used for error handling.
2
3
/// Logs an error, ignores an `Ok` value.
4
macro_rules! log_if_err {
5
    ($x:expr) => {
6
0
        let closure = || {
7
0
            try_else_return!($x);
8
0
        };
Unexecuted instantiation: criterion::analysis::compare::estimates::<_>::{closure#0}
Unexecuted instantiation: criterion::analysis::common::<_, _>::{closure#2}
Unexecuted instantiation: criterion::analysis::common::<_, _>::{closure#3}
Unexecuted instantiation: criterion::analysis::common::<_, _>::{closure#4}
Unexecuted instantiation: criterion::analysis::common::<_, _>::{closure#5}
Unexecuted instantiation: criterion::analysis::common::<_, _>::{closure#6}
9
        closure();
10
    };
11
}
12
13
/// Matches a result, returning the `Ok` value in case of success,
14
/// exits the calling function otherwise.
15
/// A closure which returns the return value for the function can
16
/// be passed as second parameter.
17
macro_rules! try_else_return {
18
    ($x:expr) => {
19
0
        try_else_return!($x, || {})
Unexecuted instantiation: criterion::analysis::compare::estimates::<_>::{closure#0}::{closure#0}
Unexecuted instantiation: criterion::analysis::common::<_, _>::{closure#2}::{closure#0}
Unexecuted instantiation: criterion::analysis::common::<_, _>::{closure#3}::{closure#0}
Unexecuted instantiation: criterion::analysis::common::<_, _>::{closure#4}::{closure#0}
Unexecuted instantiation: criterion::analysis::common::<_, _>::{closure#5}::{closure#0}
Unexecuted instantiation: criterion::analysis::common::<_, _>::{closure#6}::{closure#0}
Unexecuted instantiation: criterion::analysis::copy_new_dir_to_base::{closure#0}
Unexecuted instantiation: criterion::analysis::copy_new_dir_to_base::{closure#1}
Unexecuted instantiation: criterion::analysis::copy_new_dir_to_base::{closure#2}
Unexecuted instantiation: criterion::analysis::copy_new_dir_to_base::{closure#3}
Unexecuted instantiation: criterion::analysis::copy_new_dir_to_base::{closure#4}
Unexecuted instantiation: <criterion::html::Html as criterion::report::Report>::measurement_complete::{closure#2}
Unexecuted instantiation: <criterion::html::Html as criterion::report::Report>::measurement_complete::{closure#3}
Unexecuted instantiation: <criterion::html::Html as criterion::report::Report>::final_summary::{closure#3}
Unexecuted instantiation: <criterion::html::Html as criterion::report::Report>::final_summary::{closure#4}
Unexecuted instantiation: <criterion::html::Html as criterion::report::Report>::final_summary::{closure#5}
Unexecuted instantiation: <criterion::html::Html>::generate_plots::{closure#0}
Unexecuted instantiation: <criterion::html::Html>::generate_plots::{closure#1}
20
    };
21
    ($x:expr, $el:expr) => {
22
        match $x {
23
            Ok(x) => x,
24
            Err(e) => {
25
                crate::error::log_error(&e);
26
                let closure = $el;
27
                return closure();
28
            }
29
        }
30
    };
31
}
32
33
/// Print an error message to stdout. Format is the same as println! or format!
34
macro_rules! error {
35
    ($($arg:tt)*) => (
36
        println!("Criterion.rs ERROR: {}", &format!($($arg)*))
37
    )
38
}
39
40
/// Print a debug message to stdout. Format is the same as println! or format!
41
macro_rules! info {
42
    ($($arg:tt)*) => (
43
        if $crate::debug_enabled() {
44
            println!("Criterion.rs DEBUG: {}", &format!($($arg)*))
45
        }
46
    )
47
}