From f34a222c516fcb005edd4b2db1876c76243069fb Mon Sep 17 00:00:00 2001 From: Nathan Vegdahl Date: Sun, 1 Sep 2024 09:27:15 +0200 Subject: [PATCH] Process stdin instead of opening a file path. --- src/main.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/main.rs b/src/main.rs index f8365cb..ee0db43 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,5 @@ use std::{ - fs::File, + // fs::File, io::{Cursor, Read}, }; @@ -24,10 +24,7 @@ fn main() { let text = { let mut text = String::new(); - File::open(std::env::args().nth(1).unwrap()) - .unwrap() - .read_to_string(&mut text) - .unwrap(); + std::io::stdin().read_to_string(&mut text).unwrap(); text };