Make rip work on stable

This commit is contained in:
Kevin Liu 2018-12-24 15:36:49 -08:00
parent 8d8e1b9225
commit c416dd94e8
3 changed files with 4 additions and 6 deletions

View file

@ -4,6 +4,7 @@ version = "0.11.4"
authors = ["mail@nivekuil.com"]
description = "rip: a safe and ergonomic alternative to rm"
repository = "https://github.com/nivekuil/rip"
readme = "README.org"
license = "GPL-3.0+"
include = [
"**/*.rs",

View file

@ -1,8 +1,4 @@
// -*- compile-command: "cargo build" -*-
#![feature(conservative_impl_trait)]
#![feature(io)]
#![feature(alloc_system)]
extern crate alloc_system;
#[macro_use]
extern crate clap;
extern crate core;
@ -420,7 +416,7 @@ fn record_entry(line: &str) -> RecordItem {
}
/// Takes a vector of grave paths and returns the respective lines in the record
fn lines_of_graves<'a>(f: fs::File, graves: &'a [PathBuf]) -> impl Iterator<Item = String> {
fn lines_of_graves<'a>(f: fs::File, graves: &'a [PathBuf]) -> impl Iterator<Item = String> + 'a {
BufReader::new(f)
.lines()
.filter_map(|l| l.ok())

View file

@ -26,8 +26,9 @@ fn prompt_yes<T: AsRef<str>>(prompt: T) -> bool {
println!("{} (y/N)", prompt.as_ref());
}
let stdin = BufReader::new(io::stdin());
stdin.chars().next()
stdin.bytes().next()
.and_then(|c| c.ok())
.map(|c| c as char)
.and_then(|c| Some(c == 'y' || c == 'Y'))
.unwrap_or(false)
}