Skip to content

Commit 61e0aaf

Browse files
committed
Rollup merge of #24039 - frewsxcv:patch-10, r=steveklabnik
2 parents 563cf10 + 6ff085c commit 61e0aaf

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/libcore/result.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,11 @@
3434
//! enum Version { Version1, Version2 }
3535
//!
3636
//! fn parse_version(header: &[u8]) -> Result<Version, &'static str> {
37-
//! if header.len() < 1 {
38-
//! return Err("invalid header length");
39-
//! }
40-
//! match header[0] {
41-
//! 1 => Ok(Version::Version1),
42-
//! 2 => Ok(Version::Version2),
43-
//! _ => Err("invalid version")
37+
//! match header.get(0) {
38+
//! None => Err("invalid header length"),
39+
//! Some(&1) => Ok(Version::Version1),
40+
//! Some(&2) => Ok(Version::Version2),
41+
//! Some(_) => Err("invalid version")
4442
//! }
4543
//! }
4644
//!

0 commit comments

Comments
 (0)