Skip to content

Commit e97e64f

Browse files
committed
Test completer impls
1 parent bc1667e commit e97e64f

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

src/completion.rs

+12-3
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,8 @@ fn find_unclosed_quote(s: &str) -> Option<(usize, Quote)> {
496496

497497
#[cfg(test)]
498498
mod tests {
499+
use super::{Completer, FilenameCompleter};
500+
499501
#[test]
500502
pub fn extract_word() {
501503
let break_chars = super::default_break_chars;
@@ -604,16 +606,23 @@ mod tests {
604606
#[test]
605607
pub fn candidate_impls() {
606608
struct StrCmp;
607-
impl super::Completer for StrCmp {
609+
impl Completer for StrCmp {
608610
type Candidate = &'static str;
609611
}
610612
struct RcCmp;
611-
impl super::Completer for RcCmp {
613+
impl Completer for RcCmp {
612614
type Candidate = std::rc::Rc<str>;
613615
}
614616
struct ArcCmp;
615-
impl super::Completer for ArcCmp {
617+
impl Completer for ArcCmp {
616618
type Candidate = std::sync::Arc<str>;
617619
}
618620
}
621+
622+
#[test]
623+
pub fn completer_impls() {
624+
struct Wrapper<T: Completer>(T);
625+
let boxed = Box::new(FilenameCompleter::new());
626+
let _ = Wrapper(boxed);
627+
}
619628
}

src/tty/unix.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1032,7 +1032,7 @@ impl Renderer for PosixRenderer {
10321032
}
10331033
// position the cursor within the line
10341034
if cursor.col > 0 {
1035-
write!(self.buffer, "\r\x1b[{}C", cursor.col).unwrap();
1035+
write!(self.buffer, "\r\x1b[{}C", cursor.col)?;
10361036
} else {
10371037
self.buffer.push('\r');
10381038
}

0 commit comments

Comments
 (0)