use strip_prefix over starts_with and manual slicing based on pattern length (clippy::manual_strip)
This commit is contained in:
@@ -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 => {
|
||||
|
||||
Reference in New Issue
Block a user