diff options
author | Nora <nora.widdecke@tu-bs.de> | 2019-01-12 22:33:21 +0100 |
---|---|---|
committer | Nora <nora.widdecke@tu-bs.de> | 2019-01-12 22:33:40 +0100 |
commit | e6904dc25718e8070833e1763f3b78d4176f7a74 (patch) | |
tree | 253068d56b4a3f8c238b005f9ae14018a8aca413 /src/utils/fileutil.rs | |
parent | 1eb105e6eb97777b59b782f1a59049a4339a3b2f (diff) |
make edit and copy take default input from the cursor
Diffstat (limited to 'src/utils/fileutil.rs')
-rw-r--r-- | src/utils/fileutil.rs | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/utils/fileutil.rs b/src/utils/fileutil.rs index 9a76498..3d97832 100644 --- a/src/utils/fileutil.rs +++ b/src/utils/fileutil.rs @@ -46,15 +46,11 @@ pub fn read_lines_from_file(filepath: &Path) -> io::Result<impl Iterator<Item = } } -pub fn read_lines_from_stdin() -> io::Result<impl Iterator<Item = String>> { +pub fn read_lines_from_stdin() -> Result<Vec<String>, io::Error> { let stdin = io::stdin(); - let handle = stdin.lock(); + let lines = stdin.lock().lines(); - let lines: Result<Vec<String>, io::Error> = handle.lines().collect(); - match lines { - Ok(result) => Ok(result.into_iter()), - Err(error) => Err(error) - } + lines.collect() } pub fn read_file_to_string(path: &Path) -> Result<String, String> { |