Fix Clippy warnings 1.66.0

This commit is contained in:
Fabrice Reix 2022-12-16 10:15:13 +01:00
parent d1767e1985
commit 0fc18e90ea
No known key found for this signature in database
GPG Key ID: 8D3D9DBDD96B2D30
7 changed files with 9 additions and 11 deletions

View File

@ -403,6 +403,8 @@ pub fn app(version: &str) -> Command {
}
/// Parses command line options `matches`.
// FIXME: disallow this clippy warning because of https://github.com/rust-lang/rust-clippy/issues/9766
#[allow(clippy::manual_filter)]
pub fn parse_options(matches: &ArgMatches) -> Result<CliOptions, CliError> {
let cacert_file = match get::<String>(matches, "cacert_file") {
None => None,

View File

@ -79,7 +79,7 @@ pub fn eval_file(filename: &Filename, context_dir: &ContextDir) -> Result<Vec<u8
});
}
let resolved_file = context_dir.get_path(&file);
match std::fs::read(&resolved_file) {
match std::fs::read(resolved_file) {
Ok(value) => Ok(value),
Err(_) => Err(Error {
source_info: filename.source_info.clone(),

View File

@ -49,7 +49,7 @@ pub fn eval_version_status_asserts(
if let StatusValue::Specific(v) = status.value {
asserts.push(AssertResult::Status {
actual: http_response.status as u64,
expected: v as u64,
expected: v,
source_info: status.source_info.clone(),
});
}

View File

@ -457,7 +457,7 @@ fn error_string(filename: &str, content: &str, error: &dyn Error, colored: bool)
} else {
let line = lines.get(line_number - 1).unwrap();
let width = if error.source_info().end.column > column_number {
(error.source_info().end.column - column_number) as usize
error.source_info().end.column - column_number
} else {
0
};

View File

@ -149,11 +149,7 @@ fn levenshtein_distance(s1: &str, s2: &str) -> usize {
cmp::min(v1, cmp::min(v2, v3))
}
fn delta(x: char, y: char) -> usize {
if x == y {
0
} else {
1
}
usize::from(x != y)
}
let mut column: Vec<usize> = (0..=v1.len()).collect();

View File

@ -145,7 +145,7 @@ fn log_error(
}
} else {
let line = lines.get(error.source_info().start.line - 1).unwrap();
let width = (error.source_info().end.column - error.source_info().start.column) as usize;
let width = error.source_info().end.column - error.source_info().start.column;
let mut tab_shift = 0;
for (i, c) in line.chars().enumerate() {

View File

@ -475,11 +475,11 @@ fn json_predicate_value(predicate_value: PredicateValue) -> (JValue, Option<Stri
PredicateValue::Bool(value) => (JValue::Boolean(value), None),
PredicateValue::Null {} => (JValue::Null, None),
PredicateValue::Hex(value) => (
JValue::String(base64::encode(&value.value)),
JValue::String(base64::encode(value.value)),
Some("base64".to_string()),
),
PredicateValue::Base64(value) => (
JValue::String(base64::encode(&value.value)),
JValue::String(base64::encode(value.value)),
Some("base64".to_string()),
),
PredicateValue::Expression(value) => (JValue::String(value.to_string()), None),