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
2323 &self,
2424 home_for_user: impl FnOnce(&UserExpansion) -> Option<PathBuf>,
2525 ) -> Result<PathBuf, Error> {
26− fn join_relative(mut base: PathBuf, path: &Path) -> PathBuf {
27− base.extend(path.components().skip(1));
28− base
26+ fn make_relative(path: &Path) -> PathBuf {
27+ path.components().skip(1).collect()
2928 }
3029 let path = self.path.to_path()?;
3130 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)),
3332 None => self.path.to_path()?.into(),
3433 })
3534 }

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