QuickSnip

Tag: rust

Idiomatic Rust file read with proper error propagation.

use std::fs;
use std::io;

fn read_config(path: &str) -> io::Result<String> {
    let contents = fs::read_to_string(path)?;
    Ok(contents)
}

+6 more lines…

Updated Jul 17, 2026