From a2fd96b0331b6fbe2d16fefcde3fefe717adaa34 Mon Sep 17 00:00:00 2001 From: Alex Rutar Date: Fri, 3 Jan 2025 16:11:00 +0100 Subject: [PATCH] Do not lock stdin() in fzf example --- README.md | 8 ++------ examples/fzf.rs | 8 ++------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index ebc5bc9..53d2c7b 100644 --- a/README.md +++ b/README.md @@ -43,11 +43,7 @@ cat myfile.txt | ./target/release/examples/fzf ``` The code to create the binary: ```rust -use std::{ - io::{self, BufRead}, - process::exit, - thread::spawn, -}; +use std::{io, process::exit, thread::spawn}; use nucleo_picker::{render::StrRenderer, Picker}; @@ -56,7 +52,7 @@ fn main() -> io::Result<()> { let injector = picker.injector(); spawn(move || { - for line in io::stdin().lock().lines() { + for line in io::stdin().lines() { if let Ok(s) = line { injector.push(s); } diff --git a/examples/fzf.rs b/examples/fzf.rs index d7ac8bd..dbeb133 100644 --- a/examples/fzf.rs +++ b/examples/fzf.rs @@ -2,11 +2,7 @@ //! //! Read lines from `stdin` in a streaming fashion and populate the picker, imitating the basic //! functionality of [fzf](https://github.com/junegunn/fzf). -use std::{ - io::{self, BufRead}, - process::exit, - thread::spawn, -}; +use std::{io, process::exit, thread::spawn}; use nucleo_picker::{render::StrRenderer, Picker}; @@ -15,7 +11,7 @@ fn main() -> io::Result<()> { let injector = picker.injector(); spawn(move || { - for line in io::stdin().lock().lines() { + for line in io::stdin().lines() { // silently drop IO errors! if let Ok(s) = line { injector.push(s);