Try again with math-like externals (#4629)

* Try again with math-like externals

* clippy 1.59

* clippy 1.59

* clippy 1.59
This commit is contained in:
JT
2022-02-24 14:02:28 -05:00
committed by GitHub
parent 2c9d8c4818
commit 3c62d27c28
21 changed files with 77 additions and 54 deletions

View File

@ -188,7 +188,7 @@ fn convert_int(input: &Value, head: Span, radix: u32) -> Value {
Value::Int { val, .. } => val.to_string(),
Value::String { val, .. } => {
if val.starts_with("0x") || val.starts_with("0b") {
match int_from_string(&val.to_string(), head) {
match int_from_string(val, head) {
Ok(x) => return Value::Int { val: x, span: head },
Err(e) => return Value::Error { error: e },
}

View File

@ -451,7 +451,7 @@ fn html_value(value: Value, config: &Config) -> String {
}
other => output_string.push_str(
&htmlescape::encode_minimal(&other.into_abbreviated_string(config))
.replace("\n", "<br>"),
.replace('\n', "<br>"),
),
}
output_string

View File

@ -248,7 +248,7 @@ pub fn run_seq(
};
let last = {
let slice = &free[free.len() - 1][..];
padding = cmp::max(padding, slice.find('.').unwrap_or_else(|| slice.len()));
padding = cmp::max(padding, slice.find('.').unwrap_or(slice.len()));
match parse_float(slice) {
Ok(n) => n,
Err(s) => {

View File

@ -423,7 +423,7 @@ fn generate_ansi_code_list(
let cols = vec!["name".into(), "short name".into(), "code".into()];
let name: Value = Value::string(String::from(ansi_code.long_name), call_span);
let short_name = Value::string(ansi_code.short_name.unwrap_or(""), call_span);
let code_string = String::from(&ansi_code.code.replace("\u{1b}", ""));
let code_string = String::from(&ansi_code.code.replace('\u{1b}', ""));
let code = Value::string(code_string, call_span);
let vals = vec![name, short_name, code];
Value::Record {

View File

@ -397,7 +397,7 @@ impl ExternalCommand {
// Clean the args before we use them:
// https://stackoverflow.com/questions/1200235/how-to-pass-a-quoted-pipe-character-to-cmd-exe
// cmd.exe needs to have a caret to escape a pipe
let arg = arg.item.replace("|", "^|");
let arg = arg.item.replace('|', "^|");
process.arg(&arg);
}
process