#[macro_export]
macro_rules! if_let {
{ $($variant:ident)::+ ($binding:pat) = $input:expr;
- match $($otherwise:tt)*
+ else $($otherwise:tt)*
} => {
let $binding = match $input {
- $($variant)::+ (y) => y,
- $($otherwise)*,
+ $($variant)::+ (y) => y,
+ _ => { $($otherwise)* },
};
};
{ $($variant:ident)::+ ($binding:pat) = $input:expr;
- else $($otherwise:tt)*
+ $($otherwise:tt)*
} => {
let $binding = match $input {
- $($variant)::+ (y) => y,
- _ => { $($otherwise)* },
+ $($variant)::+ (y) => y,
+ $($otherwise)*,
};
};
{ $($variant:ident)::+ {$binding:ident} = $input:expr;
};
};
{ $($variant:ident)::+ {$binding:ident} = $input:expr;
- match $($otherwise:tt)*
+ $($otherwise:tt)*
} => {
let $binding = match $input {
$($variant)::+ { $binding } => $binding,
pub fn truncate_all_besteffort(instance: &InstanceName) {
if_let!{
Ok(bundles) = InstanceBundles::scan_game_bundles(instance);
- match Err(e) => {
+ Err(e) => {
error!("failed to scan game bundles for {}: {}", instance, e);
return;
}
for entry in bundles {
if_let!{
Ok((fpath,_what)) = entry;
- match Err(e) => {
+ Err(e) => {
error!("failed to make sense of a pathname for {}: {}", instance, e);
continue;
}
};
if_let!{
Ok(_) = File::create(&fpath);
- match Err(e) => {
+ Err(e) => {
warn!("failed to truncate a bundle for {}: {}: {}",
instance, fpath, e);
continue;