aboutsummaryrefslogtreecommitdiff
path: root/src/voice/streamer.rs
diff options
context:
space:
mode:
authorZeyla Hellyer <[email protected]>2017-09-18 17:48:52 -0700
committerZeyla Hellyer <[email protected]>2017-09-18 17:48:52 -0700
commitdae2cb77b407044f44a7a2790d93efba3891854e (patch)
treebef263c4490536cf8b56e988e71dd1aa43bc2696 /src/voice/streamer.rs
parentFix compiles of a variety of feature combinations (diff)
downloadserenity-dae2cb77b407044f44a7a2790d93efba3891854e.tar.xz
serenity-dae2cb77b407044f44a7a2790d93efba3891854e.zip
Apply rustfmt
Diffstat (limited to 'src/voice/streamer.rs')
-rw-r--r--src/voice/streamer.rs24
1 files changed, 10 insertions, 14 deletions
diff --git a/src/voice/streamer.rs b/src/voice/streamer.rs
index cf62d27..4702bdb 100644
--- a/src/voice/streamer.rs
+++ b/src/voice/streamer.rs
@@ -65,12 +65,10 @@ impl<R: Read + Send> AudioSource for InputSource<R> {
Some(frame)
},
- Err(ref e) => {
- if e.kind() == IoErrorKind::UnexpectedEof {
- Some(Vec::new())
- } else {
- None
- }
+ Err(ref e) => if e.kind() == IoErrorKind::UnexpectedEof {
+ Some(Vec::new())
+ } else {
+ None
},
}
}
@@ -194,11 +192,9 @@ pub fn ytdl(uri: &str) -> Result<Box<AudioSource>> {
};
let uri = match obj.remove("url") {
- Some(v) => {
- match v {
- Value::String(uri) => uri,
- other => return Err(Error::Voice(VoiceError::YouTubeDLUrl(other))),
- }
+ Some(v) => match v {
+ Value::String(uri) => uri,
+ other => return Err(Error::Voice(VoiceError::YouTubeDLUrl(other))),
},
None => return Err(Error::Voice(VoiceError::YouTubeDLUrl(Value::Object(obj)))),
};
@@ -224,9 +220,9 @@ fn is_stereo(path: &OsStr) -> Result<bool> {
.ok_or(Error::Voice(VoiceError::Streams))?;
let check = streams.iter().any(|stream| {
- let channels = stream.as_object().and_then(|m| {
- m.get("channels").and_then(|v| v.as_i64())
- });
+ let channels = stream
+ .as_object()
+ .and_then(|m| m.get("channels").and_then(|v| v.as_i64()));
channels == Some(2)
});