History

refactor

Sebastian Thiel committed 6 years ago

Commit e54681a1 parent ac89d381 file · +3 −4Browse files

Unified · Split

git-url/src/expand_path.rs+3−4
@@ -23,13 +23,12 @@ impl Url { · 22 unmodified lines
23 &self,23 &self,
24 home_for_user: impl FnOnce(&UserExpansion) -> Option<PathBuf>,24 home_for_user: impl FnOnce(&UserExpansion) -> Option<PathBuf>,
25 ) -> Result<PathBuf, Error> {25 ) -> Result<PathBuf, Error> {
26 fn join_relative(mut base: PathBuf, path: &Path) -> PathBuf {26 fn make_relative(path: &Path) -> PathBuf {
27 base.extend(path.components().skip(1));27 path.components().skip(1).collect()
28 base
29 }28 }
30 let path = self.path.to_path()?;29 let path = self.path.to_path()?;
31 Ok(match self.expansion.as_ref() {30 Ok(match self.expansion.as_ref() {
32 Some(user) => join_relative(home_for_user(user).ok_or(Error::MissingHome)?, path),31 Some(user) => home_for_user(user).ok_or(Error::MissingHome)?.join(make_relative(path)),
33 None => self.path.to_path()?.into(),32 None => self.path.to_path()?.into(),
34 })33 })
35 }34 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t