فهرست منبع

Work around connect being deprecated in Nightly and join not being in Stable yet.

Simon Sapin 11 سال پیش
والد
کامیت
a380188546
1فایلهای تغییر یافته به همراه7 افزوده شده و 1 حذف شده
  1. 7 1
      src/tests.rs

+ 7 - 1
src/tests.rs

@@ -75,7 +75,7 @@ fn url_parsing() {
                 let host = host.serialize();
                 assert_eq!(host, expected_host);
                 assert_eq!(port, expected_port);
-                assert_eq!(Some(format!("/{}", path.connect("/"))), expected_path);
+                assert_eq!(Some(format!("/{}", str_join(&path, "/"))), expected_path);
             },
             SchemeData::NonRelative(scheme_data) => {
                 assert_eq!(Some(scheme_data), expected_path);
@@ -95,6 +95,12 @@ fn url_parsing() {
     }
 }
 
+// FIMXE: Remove this when &[&str]::join (the new name) lands in the stable channel.
+#[allow(deprecated)]
+fn str_join<T: ::std::borrow::Borrow<str>>(pieces: &[T], separator: &str) -> String {
+    pieces.connect(separator)
+}
+
 struct Test {
     input: String,
     base: String,