use strip_prefix over starts_with and manual slicing based on pattern length (clippy::manual_strip)
This commit is contained in:
parent
95386b656e
commit
012974da7a
8 changed files with 28 additions and 26 deletions
|
@ -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 => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue