Feat: question mark unwrap.

This commit is contained in:
Ian Rettig
2025-06-06 17:02:32 -04:00
parent d41577ef7d
commit d7d2c74b23
+1 -9
View File
@@ -12,15 +12,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>>{
// let content = std::fs::read_to_string(&args.path).expect("Could not read file."); // let content = std::fs::read_to_string(&args.path).expect("Could not read file.");
let result = std::fs::read_to_string(&args.path); let content = std::fs::read_to_string(&args.path)?;
let content = match result {
Ok(content) => {
content
},
Err(error) => {
return Err(error.into());
}
};
for line in content.lines() { for line in content.lines() {
if line.contains(&args.pattern) { if line.contains(&args.pattern) {