1
Fork 0

use strip_prefix over starts_with and manual slicing based on pattern length (clippy::manual_strip)

This commit is contained in:
Matthias Krüger 2020-09-17 10:13:16 +02:00
parent 95386b656e
commit 012974da7a
8 changed files with 28 additions and 26 deletions

View file

@ -4,8 +4,7 @@ use std::fs;
use std::io;
pub fn arg_expand(arg: String) -> Result<Vec<String>, Error> {
if arg.starts_with('@') {
let path = &arg[1..];
if let Some(path) = arg.strip_prefix('@') {
let file = match fs::read_to_string(path) {
Ok(file) => file,
Err(ref err) if err.kind() == io::ErrorKind::InvalidData => {