about summary refs log tree commit diff
path: root/src/libgraphviz/lib.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-01-31 03:57:01 +0000
committerbors <bors@rust-lang.org>2015-01-31 03:57:01 +0000
commit474b324eda10440d6568ef872a7307d38e7de95b (patch)
tree53fc5aaa615f1c6e5abd757e42a75b3d19ce3abb /src/libgraphviz/lib.rs
parent1d00c545ede609b9d43fdf9f252c15da5a66dac7 (diff)
parente8fd9d3d0bf0f4974460337df29c0d3ceb514987 (diff)
downloadrust-474b324eda10440d6568ef872a7307d38e7de95b.tar.gz
rust-474b324eda10440d6568ef872a7307d38e7de95b.zip
Auto merge of #21791 - alexcrichton:rollup, r=alexcrichton
Diffstat (limited to 'src/libgraphviz/lib.rs')
-rw-r--r--src/libgraphviz/lib.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/libgraphviz/lib.rs b/src/libgraphviz/lib.rs
index 21d5cd3d516..3606387ad23 100644
--- a/src/libgraphviz/lib.rs
+++ b/src/libgraphviz/lib.rs
@@ -274,7 +274,7 @@
        html_favicon_url = "http://www.rust-lang.org/favicon.ico",
        html_root_url = "http://doc.rust-lang.org/nightly/")]
 #![feature(slicing_syntax)]
-#![allow(unknown_features)] #![feature(int_uint)]
+#![feature(int_uint)]
 #![feature(collections)]
 #![feature(core)]
 #![feature(io)]
@@ -362,19 +362,19 @@ impl<'a> Id<'a> {
     ///
     /// Passing an invalid string (containing spaces, brackets,
     /// quotes, ...) will return an empty `Err` value.
-    pub fn new<Name: IntoCow<'a, String, str>>(name: Name) -> Option<Id<'a>> {
+    pub fn new<Name: IntoCow<'a, String, str>>(name: Name) -> Result<Id<'a>, ()> {
         let name = name.into_cow();
         {
             let mut chars = name.chars();
             match chars.next() {
                 Some(c) if is_letter_or_underscore(c) => { ; },
-                _ => return None
+                _ => return Err(())
             }
             if !chars.all(is_constituent) {
-                return None
+                return Err(())
             }
         }
-        return Some(Id{ name: name });
+        return Ok(Id{ name: name });
 
         fn is_letter_or_underscore(c: char) -> bool {
             in_range('a', c, 'z') || in_range('A', c, 'Z') || c == '_'
@@ -878,8 +878,8 @@ r#"digraph syntax_tree {
     fn simple_id_construction() {
         let id1 = Id::new("hello");
         match id1 {
-            Some(_) => {;},
-            None => panic!("'hello' is not a valid value for id anymore")
+            Ok(_) => {;},
+            Err(..) => panic!("'hello' is not a valid value for id anymore")
         }
     }
 
@@ -887,8 +887,8 @@ r#"digraph syntax_tree {
     fn badly_formatted_id() {
         let id2 = Id::new("Weird { struct : ure } !!!");
         match id2 {
-            Some(_) => panic!("graphviz id suddenly allows spaces, brackets and stuff"),
-            None => {;}
+            Ok(_) => panic!("graphviz id suddenly allows spaces, brackets and stuff"),
+            Err(..) => {;}
         }
     }
 }