aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZeyla Hellyer <[email protected]>2017-08-22 22:27:44 -0700
committerZeyla Hellyer <[email protected]>2017-08-22 22:27:44 -0700
commit5388ea94114b9300e7628c2a98862ff6be966040 (patch)
treefb5186dd121db65ce46917479323b0ae6f8fb81f /src
parentAdd `with_config{_mut}` (diff)
downloadserenity-5388ea94114b9300e7628c2a98862ff6be966040.tar.xz
serenity-5388ea94114b9300e7628c2a98862ff6be966040.zip
Apply rustfmt fixes
Diffstat (limited to 'src')
-rw-r--r--src/utils/mod.rs14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/utils/mod.rs b/src/utils/mod.rs
index 8f83c07..180fa2d 100644
--- a/src/utils/mod.rs
+++ b/src/utils/mod.rs
@@ -20,7 +20,7 @@ use std::path::Path;
use internal::prelude::*;
use model::{EmojiId, EmojiIdentifier};
use cache::Cache;
-use ::CACHE;
+use CACHE;
/// Determines if a name is NSFW.
///
@@ -445,11 +445,12 @@ pub fn shard_id(guild_id: u64, shard_count: u64) -> u64 { (guild_id >> 22) % sha
///
/// ```rust,ignore
/// use serenity::utils;
-///
+///
/// // assuming that the id is `1234`:
/// assert_eq!(1234, utils::with_cache(|cache| cache.user.id));
/// ```
-pub fn with_cache<T, F>(f: F) -> T where F: Fn(&Cache) -> T {
+pub fn with_cache<T, F>(f: F) -> T
+ where F: Fn(&Cache) -> T {
let cache = CACHE.read().unwrap();
f(&cache)
}
@@ -462,13 +463,14 @@ pub fn with_cache<T, F>(f: F) -> T where F: Fn(&Cache) -> T {
///
/// ```rust,ignore
/// use serenity::utils;
-///
+///
/// // assuming that the id is `1234`:
/// assert_eq!(1234, utils::with_cache_mut(|cache| { cache.shard_count = 8; cache.user.id }));
/// ```
///
/// [`with_cache`]: #fn.with_cache
-pub fn with_cache_mut<T, F>(mut f: F) -> T where F: FnMut(&mut Cache) -> T {
+pub fn with_cache_mut<T, F>(mut f: F) -> T
+ where F: FnMut(&mut Cache) -> T {
let mut cache = CACHE.write().unwrap();
f(&mut cache)
-} \ No newline at end of file
+}