mirror of
https://github.com/Orange-OpenSource/hurl.git
synced 2024-11-05 07:06:16 +03:00
Fix Clippy warnings 1.66.0
This commit is contained in:
parent
d1767e1985
commit
0fc18e90ea
@ -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,
|
||||
|
@ -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(),
|
||||
|
@ -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(),
|
||||
});
|
||||
}
|
||||
|
@ -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
|
||||
};
|
||||
|
@ -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();
|
||||
|
@ -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() {
|
||||
|
@ -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),
|
||||
|
Loading…
Reference in New Issue
Block a user