sodium: Pass &Path instead of &PathBuf

This commit is contained in:
Sebastian Dröge 2021-03-25 20:14:26 +02:00
parent f8adb42f7b
commit 5e89d345d8
2 changed files with 4 additions and 4 deletions

View file

@ -28,7 +28,7 @@ use sodiumoxide::crypto::box_;
use std::error::Error;
use std::fs::File;
use std::path::PathBuf;
use std::path::{Path, PathBuf};
use clap::{App, Arg};
use serde::{Deserialize, Serialize};
@ -40,7 +40,7 @@ struct Keys {
}
impl Keys {
fn from_file(file: &PathBuf) -> Result<Self, Box<dyn Error>> {
fn from_file(file: &Path) -> Result<Self, Box<dyn Error>> {
let f = File::open(&file)?;
serde_json::from_reader(f).map_err(From::from)
}

View file

@ -28,7 +28,7 @@ use sodiumoxide::crypto::box_;
use std::error::Error;
use std::fs::File;
use std::path::PathBuf;
use std::path::{Path, PathBuf};
use clap::{App, Arg};
use serde::{Deserialize, Serialize};
@ -40,7 +40,7 @@ struct Keys {
}
impl Keys {
fn from_file(file: &PathBuf) -> Result<Self, Box<dyn Error>> {
fn from_file(file: &Path) -> Result<Self, Box<dyn Error>> {
let f = File::open(&file)?;
serde_json::from_reader(f).map_err(From::from)
}