Skip to content

Commit 8cd71c1

Browse files
ericktgraydon
authored andcommitted
---
yaml --- r: 40489 b: refs/heads/dist-snap c: ab5d842 h: refs/heads/master i: 40487: 9e428fd v: v3
1 parent 007caae commit 8cd71c1

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: a810c03263670238bccd64cabb12a23a46e3a278
99
refs/heads/incoming: e90142e536c150df0d9b4b2f11352152177509b5
10-
refs/heads/dist-snap: e1a552a628f13d8325f680327645ee0f446d250c
10+
refs/heads/dist-snap: ab5d84258e25eb74d0293df444e200561010b5df
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/libcore/path.rs

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,22 @@ pub struct WindowsPath {
1717
components: ~[~str],
1818
}
1919

20+
pub pure fn WindowsPath(s: &str) -> WindowsPath {
21+
from_str(s)
22+
}
23+
2024
pub struct PosixPath {
2125
is_absolute: bool,
2226
components: ~[~str],
2327
}
2428

29+
pub pure fn PosixPath(s: &str) -> PosixPath {
30+
from_str(s)
31+
}
32+
2533
pub trait GenericPath {
2634

27-
static pure fn from_str((&str)) -> self;
35+
static pure fn from_str(&str) -> self;
2836

2937
pure fn dirname() -> ~str;
3038
pure fn filename() -> Option<~str>;
@@ -49,15 +57,15 @@ pub type Path = WindowsPath;
4957

5058
#[cfg(windows)]
5159
pub pure fn Path(s: &str) -> Path {
52-
from_str::<WindowsPath>(s)
60+
WindowsPath(s)
5361
}
5462

5563
#[cfg(unix)]
5664
pub type Path = PosixPath;
5765

5866
#[cfg(unix)]
5967
pub pure fn Path(s: &str) -> Path {
60-
from_str::<PosixPath>(s)
68+
PosixPath(s)
6169
}
6270

6371
impl PosixPath : ToStr {
@@ -166,7 +174,7 @@ impl PosixPath : GenericPath {
166174
}
167175

168176
pure fn with_dirname(d: &str) -> PosixPath {
169-
let dpath = from_str::<PosixPath>(d);
177+
let dpath = PosixPath(d);
170178
match self.filename() {
171179
Some(ref f) => dpath.push(*f),
172180
None => move dpath
@@ -365,7 +373,7 @@ impl WindowsPath : GenericPath {
365373
}
366374

367375
pure fn with_dirname(d: &str) -> WindowsPath {
368-
let dpath = from_str::<WindowsPath>(d);
376+
let dpath = WindowsPath(d);
369377
match self.filename() {
370378
Some(ref f) => dpath.push(*f),
371379
None => move dpath
@@ -493,12 +501,12 @@ pub pure fn normalize(components: &[~str]) -> ~[~str] {
493501
#[test]
494502
fn test_double_slash_collapsing()
495503
{
496-
let path = from_str::<PosixPath>("tmp/");
504+
let path = PosixPath("tmp/");
497505
let path = path.push("/hmm");
498506
let path = path.normalize();
499507
assert ~"tmp/hmm" == path.to_str();
500508

501-
let path = from_str::<WindowsPath>("tmp/");
509+
let path = WindowsPath("tmp/");
502510
let path = path.push("/hmm");
503511
let path = path.normalize();
504512
assert ~"tmp\\hmm" == path.to_str();
@@ -507,7 +515,7 @@ fn test_double_slash_collapsing()
507515
mod posix {
508516

509517
#[cfg(test)]
510-
fn mk(s: &str) -> PosixPath { from_str::<PosixPath>(s) }
518+
fn mk(s: &str) -> PosixPath { PosixPath(s) }
511519

512520
#[cfg(test)]
513521
fn t(wp: &PosixPath, s: &str) {
@@ -661,7 +669,7 @@ mod windows {
661669

662670
#[test]
663671
fn test_windows_paths() {
664-
fn mk(s: &str) -> WindowsPath { from_str::<WindowsPath>(s) }
672+
fn mk(s: &str) -> WindowsPath { WindowsPath(s) }
665673
fn t(wp: &WindowsPath, s: &str) {
666674
let ss = wp.to_str();
667675
let sss = str::from_slice(s);
@@ -705,7 +713,7 @@ mod windows {
705713
}
706714

707715
#[cfg(test)]
708-
fn mk(s: &str) -> PosixPath { from_str::<PosixPath>(s) }
716+
fn mk(s: &str) -> PosixPath { PosixPath(s) }
709717

710718
#[test]
711719
fn test_filetype_foo_bar() {

0 commit comments

Comments
 (0)