about summary refs log tree commit diff
path: root/src/libstd/path
diff options
context:
space:
mode:
authorKevin Ballard <kevin@sb.org>2013-10-02 22:29:46 -0700
committerKevin Ballard <kevin@sb.org>2013-10-15 21:56:54 -0700
commited539e14712539473c3e89604cb69e2307110772 (patch)
treebc92a3c7dfe9aa37daa589352de69f73adb4eab3 /src/libstd/path
parenteaec8a71322a59eb284cbd5a8d502b6da321df3c (diff)
downloadrust-ed539e14712539473c3e89604cb69e2307110772.tar.gz
rust-ed539e14712539473c3e89604cb69e2307110772.zip
path2: Remove Path::normalize()
There are no clients of this API, so just remove it.

Update the module docstring to mention normalization.
Diffstat (limited to 'src/libstd/path')
-rw-r--r--src/libstd/path/mod.rs4
-rw-r--r--src/libstd/path/posix.rs2
-rw-r--r--src/libstd/path/windows.rs7
3 files changed, 5 insertions, 8 deletions
diff --git a/src/libstd/path/mod.rs b/src/libstd/path/mod.rs
index 41fe31daae9..1ecb31a2a87 100644
--- a/src/libstd/path/mod.rs
+++ b/src/libstd/path/mod.rs
@@ -43,6 +43,10 @@ Option<&str> with `.as_str()`. Similarly, attributes of the path can be queried
 with methods such as `.filename()`. There are also methods that return a new
 path instead of modifying the receiver, such as `.join()` or `.dir_path()`.
 
+Paths are always kept in normalized form. This means that creating the path
+`Path::from_str("a/b/../c")` will return the path `a/c`. Similarly any attempt
+to mutate the path will always leave it in normalized form.
+
 When rendering a path to some form of display, there is a method `.display()`
 which is compatible with the `format!()` parameter `{}`. This will render the
 path as a string, replacing all non-utf8 sequences with the Replacement
diff --git a/src/libstd/path/posix.rs b/src/libstd/path/posix.rs
index b0b6d1ceea0..f39062e66cb 100644
--- a/src/libstd/path/posix.rs
+++ b/src/libstd/path/posix.rs
@@ -349,7 +349,7 @@ impl Path {
 
     /// Returns a normalized byte vector representation of a path, by removing all empty
     /// components, and unnecessary . and .. components.
-    pub fn normalize<V: Vector<u8>+CopyableVector<u8>>(v: V) -> ~[u8] {
+    fn normalize<V: Vector<u8>+CopyableVector<u8>>(v: V) -> ~[u8] {
         // borrowck is being very picky
         let val = {
             let is_abs = !v.as_slice().is_empty() && v.as_slice()[0] == sep;
diff --git a/src/libstd/path/windows.rs b/src/libstd/path/windows.rs
index 620b7c375ff..5dfe5b4f35a 100644
--- a/src/libstd/path/windows.rs
+++ b/src/libstd/path/windows.rs
@@ -697,13 +697,6 @@ impl Path {
         Some(self.repr)
     }
 
-    /// Returns a normalized string representation of a path, by removing all empty
-    /// components, and unnecessary . and .. components.
-    pub fn normalize<S: Str>(s: S) -> ~str {
-        let (_, path) = Path::normalize_(s);
-        path
-    }
-
     /// Returns an iterator that yields each component of the path in turn as a Option<&str>.
     /// Every component is guaranteed to be Some.
     /// Does not yield the path prefix (including server/share components in UNC paths).