From 30dbcf5f88b20db3ea1c70bb50cb37fa9364f1a9 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Mon, 12 May 2014 21:36:30 -0700 Subject: [PATCH] libglob: Remove all uses of `~str` from `libglob` --- src/libglob/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libglob/lib.rs b/src/libglob/lib.rs index cd6b61049e0..7b9260c7eb9 100644 --- a/src/libglob/lib.rs +++ b/src/libglob/lib.rs @@ -310,7 +310,7 @@ impl Pattern { * brackets. The resulting string will, when compiled into a `Pattern`, * match the input string and nothing else. */ - pub fn escape(s: &str) -> ~str { + pub fn escape(s: &str) -> StrBuf { let mut escaped = StrBuf::new(); for c in s.chars() { match c { @@ -325,7 +325,7 @@ impl Pattern { } } } - escaped.into_owned() + escaped } /** @@ -767,8 +767,8 @@ mod test { #[test] fn test_pattern_escape() { let s = "_[_]_?_*_!_"; - assert_eq!(Pattern::escape(s), "_[[]_[]]_[?]_[*]_!_".to_owned()); - assert!(Pattern::new(Pattern::escape(s)).matches(s)); + assert_eq!(Pattern::escape(s), "_[[]_[]]_[?]_[*]_!_".to_strbuf()); + assert!(Pattern::new(Pattern::escape(s).as_slice()).matches(s)); } #[test]