TODO: collect_input(): Use non-panicking functions for getting args/lines (so in release builds, no panic handler is generated)

Fortune for reverse's current commit: Half curse − 半凶
master
Avril 3 years ago
parent ed75b8b766
commit 0a78bcfd55
Signed by: flanchan
GPG Key ID: 284488987C31F630

2
Cargo.lock generated

@ -4,4 +4,4 @@ version = 3
[[package]] [[package]]
name = "reverse" name = "reverse"
version = "0.2.0" version = "0.2.1"

@ -30,6 +30,7 @@ fn binsearch<'a, V: ?Sized, T: PartialEq<V> + 'a>(slice: &'a [T], find: &V) -> O
fn collect_input() -> Box<dyn Iterator<Item=String> + 'static> fn collect_input() -> Box<dyn Iterator<Item=String> + 'static>
{ {
//! TODO: Use non-panicking functions for both reading lines and reading args, just skip invalid lines/args
if std::env::args_os().len() <= 1 { if std::env::args_os().len() <= 1 {
use std::io::{ use std::io::{
self, self,
@ -73,6 +74,7 @@ fn main() {
for x in args.iter() { for x in args.iter() {
handle_fmt_err({ handle_fmt_err({
if cfg!(feature="output-quoted") { if cfg!(feature="output-quoted") {
//XXX: This doesn't flush, right? It shouldn't, but maybe we should test it?
writeln!(&mut out, "{:?}", x) writeln!(&mut out, "{:?}", x)
} }
else { else {

Loading…
Cancel
Save