Skip to content

Commit

Permalink
clippy misc
Browse files Browse the repository at this point in the history
  • Loading branch information
gwenn committed Aug 10, 2024
1 parent 4b1a527 commit 8e7b411
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/completion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ mod tests {
assert_eq!(Some(s), lcp);
}

let c3 = String::from("");
let c3 = String::new();
candidates.push(c3);
{
let lcp = super::longest_common_prefix(&candidates);
Expand Down
2 changes: 1 addition & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub enum ReadlineError {
/// Unix Error from syscall
#[cfg(unix)]
Errno(nix::Error),
/// Error generated on WINDOW_BUFFER_SIZE_EVENT / SIGWINCH signal
/// Error generated on `WINDOW_BUFFER_SIZE_EVENT` / `SIGWINCH` signal
WindowResized,
/// Like Utf8Error on unix
#[cfg(windows)]
Expand Down
2 changes: 1 addition & 1 deletion src/keymap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub enum Cmd {
Abort, // Miscellaneous Command
/// accept-line
///
/// See also AcceptOrInsertLine
/// See also `AcceptOrInsertLine`
AcceptLine,
/// beginning-of-history
BeginningOfHistory,
Expand Down
2 changes: 1 addition & 1 deletion src/test/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ mod vi_insert;
fn init_editor(mode: EditMode, keys: &[KeyEvent]) -> DefaultEditor {
let config = Config::builder().edit_mode(mode).build();
let mut editor = DefaultEditor::with_config(config).unwrap();
editor.term.keys.extend(keys.iter().cloned());
editor.term.keys.extend(keys.iter().copied());
editor
}

Expand Down
8 changes: 3 additions & 5 deletions src/tty/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ impl Read for TtyIn {
let res = unsafe {
libc::read(
self.fd,
buf.as_mut_ptr() as *mut libc::c_void,
buf.as_mut_ptr().cast::<libc::c_void>(),
buf.len() as libc::size_t,
)
};
Expand Down Expand Up @@ -1021,9 +1021,7 @@ impl Renderer for PosixRenderer {
// we have to generate our own newline on line wrap
if end_pos.col == 0
&& end_pos.row > 0
&& !hint
.map(|h| h.ends_with('\n'))
.unwrap_or_else(|| line.ends_with('\n'))
&& !hint.map_or_else(|| line.ends_with('\n'), |h| h.ends_with('\n'))
{
self.buffer.push('\n');
}
Expand Down Expand Up @@ -1440,6 +1438,7 @@ impl Term for PosixTerminal {
}

fn create_external_printer(&mut self) -> Result<ExternalPrinter> {
use nix::unistd::pipe;
if let Some(ref writer) = self.pipe_writer {
return Ok(ExternalPrinter {
writer: writer.clone(),
Expand All @@ -1450,7 +1449,6 @@ impl Term for PosixTerminal {
if self.unsupported || !self.is_input_tty() || !self.is_output_tty() {
return Err(nix::Error::ENOTTY.into());
}
use nix::unistd::pipe;
let (sender, receiver) = mpsc::sync_channel(1); // TODO validate: bound
let (r, w) = pipe()?;
let reader = Arc::new(Mutex::new((r.into(), receiver)));
Expand Down

0 comments on commit 8e7b411

Please sign in to comment.