Skip to content

Commit

Permalink
Make example function in comment more idiomatic
Browse files Browse the repository at this point in the history
  • Loading branch information
frewsxcv committed Apr 4, 2015
1 parent f207ecb commit 6ff085c
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/libcore/result.rs
Expand Up @@ -34,13 +34,11 @@
//! enum Version { Version1, Version2 }
//!
//! fn parse_version(header: &[u8]) -> Result<Version, &'static str> {
//! if header.len() < 1 {
//! return Err("invalid header length");
//! }
//! match header[0] {
//! 1 => Ok(Version::Version1),
//! 2 => Ok(Version::Version2),
//! _ => Err("invalid version")
//! match header.get(0) {
//! None => Err("invalid header length"),
//! Some(&1) => Ok(Version::Version1),
//! Some(&2) => Ok(Version::Version2),
//! Some(_) => Err("invalid version")
//! }
//! }
//!
Expand Down

0 comments on commit 6ff085c

Please sign in to comment.