mirror of
https://github.com/uutils/diffutils.git
synced 2026-06-10 15:48:59 -07:00
Merge pull request #125 from cakebaker/clippy_fix_warnings
clippy: fix warnings from `unnecessary_unwrap` lint
This commit is contained in:
+18
-22
@@ -279,17 +279,15 @@ fn match_context_diff_params(
|
||||
context_count = Some(numvalue.as_str().parse::<usize>().unwrap());
|
||||
}
|
||||
}
|
||||
if param == "-C" && next_param.is_some() {
|
||||
match next_param.unwrap().to_string_lossy().parse::<usize>() {
|
||||
Ok(context_size) => {
|
||||
context_count = Some(context_size);
|
||||
next_param_consumed = true;
|
||||
}
|
||||
Err(_) => {
|
||||
return Err(format!(
|
||||
"invalid context length '{}'",
|
||||
next_param.unwrap().to_string_lossy()
|
||||
))
|
||||
if param == "-C" {
|
||||
if let Some(p) = next_param {
|
||||
let size_str = p.to_string_lossy();
|
||||
match size_str.parse::<usize>() {
|
||||
Ok(context_size) => {
|
||||
context_count = Some(context_size);
|
||||
next_param_consumed = true;
|
||||
}
|
||||
Err(_) => return Err(format!("invalid context length '{size_str}'")),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -325,17 +323,15 @@ fn match_unified_diff_params(
|
||||
context_count = Some(numvalue.as_str().parse::<usize>().unwrap());
|
||||
}
|
||||
}
|
||||
if param == "-U" && next_param.is_some() {
|
||||
match next_param.unwrap().to_string_lossy().parse::<usize>() {
|
||||
Ok(context_size) => {
|
||||
context_count = Some(context_size);
|
||||
next_param_consumed = true;
|
||||
}
|
||||
Err(_) => {
|
||||
return Err(format!(
|
||||
"invalid context length '{}'",
|
||||
next_param.unwrap().to_string_lossy()
|
||||
))
|
||||
if param == "-U" {
|
||||
if let Some(p) = next_param {
|
||||
let size_str = p.to_string_lossy();
|
||||
match size_str.parse::<usize>() {
|
||||
Ok(context_size) => {
|
||||
context_count = Some(context_size);
|
||||
next_param_consumed = true;
|
||||
}
|
||||
Err(_) => return Err(format!("invalid context length '{size_str}'")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user