зеркало из https://github.com/mozilla/glean.git
[Rust] Cleanup: Move the macro to where it is used
This commit is contained in:
Родитель
3c43f2c90a
Коммит
9465806d14
|
@ -12,6 +12,21 @@ use std::sync::RwLock;
|
|||
|
||||
use rkv::StoreOptions;
|
||||
|
||||
/// Unwrap a `Result`s `Ok` value or do the specified action.
|
||||
///
|
||||
/// This is an alternative to the question-mark operator (`?`),
|
||||
/// when the other action should not be to return the error.
|
||||
macro_rules! unwrap_or {
|
||||
($expr:expr, $or:expr) => {
|
||||
match $expr {
|
||||
Ok(x) => x,
|
||||
Err(_) => {
|
||||
$or;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Select the LMDB-powered storage backend when the feature is not activated.
|
||||
#[cfg(not(feature = "rkv-safe-mode"))]
|
||||
mod backend {
|
||||
|
|
|
@ -22,10 +22,6 @@ use once_cell::sync::OnceCell;
|
|||
use std::sync::Mutex;
|
||||
use uuid::Uuid;
|
||||
|
||||
// This needs to be included first, and the space below prevents rustfmt from
|
||||
// alphabetizing it.
|
||||
mod macros;
|
||||
|
||||
mod common_metric_data;
|
||||
mod coverage;
|
||||
mod database;
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
#![macro_use]
|
||||
|
||||
//! Utility macros used in this crate.
|
||||
|
||||
/// Unwrap a `Result`s `Ok` value or do the specified action.
|
||||
///
|
||||
/// This is an alternative to the question-mark operator (`?`),
|
||||
/// when the other action should not be to return the error.
|
||||
macro_rules! unwrap_or {
|
||||
($expr:expr, $or:expr) => {
|
||||
match $expr {
|
||||
Ok(x) => x,
|
||||
Err(_) => {
|
||||
$or;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
Загрузка…
Ссылка в новой задаче