Exchange From for TryFrom for PathBuf and Home

The `From` implementation would allow someone to create a `Home` in an
incorrect fashion, for example the path is not canonical.

Exchange `From` for a `TryFrom` implementation.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
This commit is contained in:
Fintan Halpenny
2023-02-17 10:37:39 +01:00
committed by Alexis Sellier
parent 3cf1accddd
commit a3f8a0b524
+3 -1
View File
@@ -1,3 +1,4 @@
use std::convert::TryInto as _;
use std::path::Path;
use std::str::FromStr;
use std::sync::Arc;
@@ -81,7 +82,8 @@ pub fn seed(dir: &Path) -> Context {
.unwrap();
// eq. rad auth
let profile = radicle::Profile::init(rad_home.into(), PASSWORD.to_owned()).unwrap();
let profile =
radicle::Profile::init(rad_home.try_into().unwrap(), PASSWORD.to_owned()).unwrap();
// rad init
rad_init::init(