Skip to content

Commit

Permalink
fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
p00f committed Oct 19, 2023
1 parent c9766b1 commit 94fa7d6
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions examples/cwd_aware_hinter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

use std::io;

use reedline::FileBackedHistory;
fn create_item(cwd: &str, cmd: &str, exit_status: i64) -> reedline::HistoryItem {
use std::time::Duration;

Expand All @@ -29,17 +28,19 @@ fn create_item(cwd: &str, cmd: &str, exit_status: i64) -> reedline::HistoryItem
fn create_filled_example_history(home_dir: &str, orig_dir: &str) -> Box<dyn reedline::History> {
use reedline::History;
#[cfg(not(any(feature = "sqlite", feature = "sqlite-dynlib")))]
let mut history = FileBackedHistory::new(100);
let mut history = Box::new(reedline::FileBackedHistory::new(100));
#[cfg(any(feature = "sqlite", feature = "sqlite-dynlib"))]
let mut history = SqliteBackedHistory::in_memory().unwrap();
let mut history = Box::new(reedline::SqliteBackedHistory::in_memory().unwrap());

history.save(create_item(orig_dir, "dummy", 0)).unwrap(); // add dummy item so ids start with 1
history.save(create_item(orig_dir, "ls /usr", 0)).unwrap();
history.save(create_item(orig_dir, "pwd", 0)).unwrap();

history.save(create_item(home_dir, "cat foo", 0)).unwrap();
history.save(create_item(home_dir, "ls bar", 0)).unwrap();
history.save(create_item(home_dir, "rm baz", 0)).unwrap();
Box::new(history)

history
}

fn main() -> io::Result<()> {
Expand Down

0 comments on commit 94fa7d6

Please sign in to comment.