comparison rust/hg-core/src/utils/hg_path.rs @ 44191:732098027b34

rust: re-format with nightly rustfmt This fixes test-check-rust-format.t. Differential Revision: https://phab.mercurial-scm.org/D8025
author Martin von Zweigbergk <martinvonz@google.com>
date Tue, 28 Jan 2020 10:40:19 -0800
parents baa4e7fdfd47
children c18dd48cea4a
comparison
equal deleted inserted replaced
44190:5de70f798ea7 44191:732098027b34
140 } 140 }
141 141
142 #[cfg(windows)] 142 #[cfg(windows)]
143 /// Copied from the Python stdlib's `os.path.splitdrive` implementation. 143 /// Copied from the Python stdlib's `os.path.splitdrive` implementation.
144 /// 144 ///
145 /// Split a pathname into drive/UNC sharepoint and relative path specifiers. 145 /// Split a pathname into drive/UNC sharepoint and relative path
146 /// Returns a 2-tuple (drive_or_unc, path); either part may be empty. 146 /// specifiers. Returns a 2-tuple (drive_or_unc, path); either part may
147 /// be empty.
147 /// 148 ///
148 /// If you assign 149 /// If you assign
149 /// result = split_drive(p) 150 /// result = split_drive(p)
150 /// It is always true that: 151 /// It is always true that:
151 /// result[0] + result[1] == p 152 /// result[0] + result[1] == p
152 /// 153 ///
153 /// If the path contained a drive letter, drive_or_unc will contain everything 154 /// If the path contained a drive letter, drive_or_unc will contain
154 /// up to and including the colon. 155 /// everything up to and including the colon.
155 /// e.g. split_drive("c:/dir") returns ("c:", "/dir") 156 /// e.g. split_drive("c:/dir") returns ("c:", "/dir")
156 /// 157 ///
157 /// If the path contained a UNC path, the drive_or_unc will contain the host 158 /// If the path contained a UNC path, the drive_or_unc will contain the
158 /// name and share up to but not including the fourth directory separator 159 /// host name and share up to but not including the fourth directory
159 /// character. 160 /// separator character.
160 /// e.g. split_drive("//host/computer/dir") returns ("//host/computer", "/dir") 161 /// e.g. split_drive("//host/computer/dir") returns ("//host/computer",
162 /// "/dir")
161 /// 163 ///
162 /// Paths cannot contain both a drive letter and a UNC path. 164 /// Paths cannot contain both a drive letter and a UNC path.
163 pub fn split_drive<'a>(&self) -> (&HgPath, &HgPath) { 165 pub fn split_drive<'a>(&self) -> (&HgPath, &HgPath) {
164 let bytes = self.as_bytes(); 166 let bytes = self.as_bytes();
165 let is_sep = |b| std::path::is_separator(b as char); 167 let is_sep = |b| std::path::is_separator(b as char);