diff options
| author | Dieter Eickstaedt <eickstaedt@deicon.de> | 2023-09-23 10:56:55 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-23 08:56:55 +0000 |
| commit | fbed2862fda127b747718e4ae6f5f36a56f29a51 (patch) | |
| tree | d34481f59f05aa5f9e0131c416373e5c1278dc17 /atuin-client/src/import/nu.rs | |
| parent | Bump debian from bullseye-20230904-slim to bullseye-20230919-slim (#1242) (diff) | |
| download | atuin-fbed2862fda127b747718e4ae6f5f36a56f29a51.zip | |
refactor: Duplications reduced in order to align implementations of reading history files (#1247)
Diffstat (limited to 'atuin-client/src/import/nu.rs')
| -rw-r--r-- | atuin-client/src/import/nu.rs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/atuin-client/src/import/nu.rs b/atuin-client/src/import/nu.rs index 1131fac5..a45d83c5 100644 --- a/atuin-client/src/import/nu.rs +++ b/atuin-client/src/import/nu.rs @@ -1,7 +1,7 @@ // import old shell history! // automatically hoover up all that we can find -use std::{fs::File, io::Read, path::PathBuf}; +use std::path::PathBuf; use async_trait::async_trait; use directories::BaseDirs; @@ -10,6 +10,7 @@ use time::OffsetDateTime; use super::{unix_byte_lines, Importer, Loader}; use crate::history::History; +use crate::import::read_to_end; #[derive(Debug)] pub struct Nu { @@ -33,10 +34,7 @@ impl Importer for Nu { const NAME: &'static str = "nu"; async fn new() -> Result<Self> { - let mut bytes = Vec::new(); - let path = get_histpath()?; - let mut f = File::open(path)?; - f.read_to_end(&mut bytes)?; + let bytes = read_to_end(get_histpath()?)?; Ok(Self { bytes }) } |
