]>
git.proxmox.com Git - cargo.git/blob - vendor/failure/tests/macro_trailing_comma.rs
6 // This test is in a separate file due to the fact that ensure! cannot be used
7 // from within failure.
9 // (you get: 'macro-expanded `macro_export` macros from the current crate cannot
10 // be referred to by absolute paths')
12 // Encloses an early-returning macro in an IIFE so that we
13 // can treat it as a Result-returning function.
14 macro_rules
! wrap_early_return
{
16 fn func() -> Result
<(), failure
::Error
> {
19 #[allow(unreachable_code)]
22 func().map_err(|e
| e
.to_string())
29 wrap_early_return
!(bail
!("test")),
30 wrap_early_return
!(bail
!("test",)));
32 wrap_early_return
!(bail
!("test {}", 4)),
33 wrap_early_return
!(bail
!("test {}", 4,)));
39 wrap_early_return
!(ensure
!(false, "test")),
40 wrap_early_return
!(ensure
!(false, "test",)));
42 wrap_early_return
!(ensure
!(false, "test {}", 4)),
43 wrap_early_return
!(ensure
!(false, "test {}", 4,)));
49 format_err
!("test").to_string(),
50 format_err
!("test",).to_string());
52 format_err
!("test {}", 4).to_string(),
53 format_err
!("test {}", 4,).to_string());