mirror of
https://github.com/nushell/nushell.git
synced 2025-05-31 15:18:23 +02:00
push to pathbuf instead of creating string
This commit is contained in:
parent
577be7321f
commit
5fffbdef2a
@ -162,11 +162,12 @@ fn relative_to(path: &Path, span: Span, args: &Arguments) -> Value {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut path: String = differing_parent.iter().map(|_| "../").collect();
|
let mut path = PathBuf::new();
|
||||||
|
differing_parent.iter().for_each(|_| path.push(".."));
|
||||||
|
|
||||||
path.push_str(&differing_child.to_string_lossy());
|
path.push(&differing_child);
|
||||||
|
|
||||||
Value::string(path, span)
|
Value::string(path.to_string_lossy(), span)
|
||||||
}
|
}
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user