diff options
| author | Kevin Ballard <kevin@sb.org> | 2013-10-06 18:51:49 -0700 |
|---|---|---|
| committer | Kevin Ballard <kevin@sb.org> | 2013-10-15 22:19:53 -0700 |
| commit | c01a97b7a981fb5ae008be7e06df4bf6a85eba4f (patch) | |
| tree | c7cba306ad49ecb103ac9674dfeb71025746a7c2 /src/libstd/path/windows.rs | |
| parent | d6d9b926836b1f1c2b8b3fe4ab35dc63bec7ffcd (diff) | |
| download | rust-c01a97b7a981fb5ae008be7e06df4bf6a85eba4f.tar.gz rust-c01a97b7a981fb5ae008be7e06df4bf6a85eba4f.zip | |
path2: Remove .with_display_str and friends
Rewrite these methods as methods on Display and FilenameDisplay. This
turns
do path.with_display_str |s| { ... }
into
do path.display().with_str |s| { ... }
Diffstat (limited to 'src/libstd/path/windows.rs')
| -rw-r--r-- | src/libstd/path/windows.rs | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/src/libstd/path/windows.rs b/src/libstd/path/windows.rs index cc04261ec66..86c4bb6f8a3 100644 --- a/src/libstd/path/windows.rs +++ b/src/libstd/path/windows.rs @@ -351,16 +351,6 @@ impl GenericPath for Path { } #[inline] - fn with_display_str<T>(&self, f: &fn(&str) -> T) -> T { - f(self.repr.as_slice()) - } - - #[inline] - fn to_display_str(&self) -> ~str { - self.repr.clone() - } - - #[inline] fn dirname<'a>(&'a self) -> &'a [u8] { self.dirname_str().unwrap().as_bytes() } @@ -1462,18 +1452,22 @@ mod tests { #[test] fn test_display_str() { - assert_eq!(Path::new("foo").to_display_str(), ~"foo"); - assert_eq!(Path::new(b!("\\")).to_filename_display_str(), None); + let path = Path::new("foo"); + assert_eq!(path.display().to_str(), ~"foo"); + let path = Path::new(b!("\\")); + assert_eq!(path.filename_display().to_str(), ~""); let mut called = false; - do Path::new("foo").with_display_str |s| { + let path = Path::new("foo"); + do path.display().with_str |s| { assert_eq!(s, "foo"); called = true; }; assert!(called); called = false; - do Path::new(b!("\\")).with_filename_display_str |s| { - assert!(s.is_none()); + let path = Path::new(b!("\\")); + do path.filename_display().with_str |s| { + assert_eq!(s, ""); called = true; } assert!(called); |
