Explorar el Código

This function was used in both

Benjamin Sago hace 8 años
padre
commit
c18302e46e
Se han modificado 1 ficheros con 9 adiciones y 14 borrados
  1. 9 14
      src/options/parser.rs

+ 9 - 14
src/options/parser.rs

@@ -187,16 +187,17 @@ fn split_on_equals(input: &OsStr) -> Option<(&OsStr, &OsStr)> {
 }
 
 
+/// Creates an `OSString` (used in tests)
 #[cfg(test)]
-mod split_test {
-    use super::split_on_equals;
-    use std::ffi::OsString;
+fn os(input: &'static str) -> OsString {
+    let mut os = OsString::new();
+    os.push(input);
+    os
+}
 
-    fn os(input: &'static str) -> OsString {
-        let mut os = OsString::new();
-        os.push(input);
-        os
-    }
+#[cfg(test)]
+mod split_test {
+    use super::{split_on_equals, os};
 
     macro_rules! test_split {
         ($name:ident: $input:expr => None) => {
@@ -239,12 +240,6 @@ mod test {
         Arg { short: Some(b'c'), long: "count", takes_value: TakesValue::Necessary }
     ];
 
-    fn os(input: &'static str) -> OsString {
-        let mut os = OsString::new();
-        os.push(input);
-        os
-    }
-
     #[test]
     fn empty() {
         let bits = [ ];