Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix nightly build issues with as_ref() #219

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions examples/example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@ fn main() {
let readline = rl.readline(PROMPT);
match readline {
Ok(line) => {
rl.add_history_entry(line.as_ref());
println!("Line: {}", line);
let line: String = line;
println!("Line: {}", &line);
rl.add_history_entry(line);
}
Err(ReadlineError::Interrupted) => {
println!("CTRL-C");
Expand Down
2 changes: 1 addition & 1 deletion src/history.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ impl History {
let file = File::open(&path)?;
let rdr = BufReader::new(file);
for line in rdr.lines() {
self.add(line?.as_ref()); // TODO truncate to MAX_LINE
self.add(line?.as_str()); // TODO truncate to MAX_LINE
}
Ok(())
}
Expand Down
5 changes: 3 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -623,8 +623,9 @@ fn readline_raw<H: Helper>(
let guard = Guard(&original_mode);
let user_input = readline_edit(prompt, initial, editor, &original_mode);
if editor.config.auto_add_history() {
if let Ok(ref line) = user_input {
editor.add_history_entry(line.as_ref());
if let Ok(line) = &user_input {
let line: &str = line;
editor.add_history_entry(line);
}
}
drop(guard); // disable_raw_mode(original_mode)?;
Expand Down
2 changes: 1 addition & 1 deletion src/tty/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ impl Renderer for ConsoleRenderer {
}
}

static SIGWINCH: atomic::AtomicBool = atomic::ATOMIC_BOOL_INIT;
static SIGWINCH: atomic::AtomicBool = atomic::AtomicBool::new(false);

#[cfg(not(test))]
pub type Terminal = Console;
Expand Down