mirror of
https://github.com/erg-lang/erg.git
synced 2025-08-04 10:49:54 +00:00
chore: fix clippy warns
This commit is contained in:
parent
53f27394fb
commit
a302235c54
5 changed files with 13 additions and 18 deletions
|
@ -587,19 +587,19 @@ fn format_context<E: ErrorDisplay + ?Sized>(
|
|||
if i == 0 && i == final_step {
|
||||
context.push_str(&" ".repeat(col_begin));
|
||||
context.push_str_with_color(
|
||||
&mark.repeat(cmp::max(1, col_end.saturating_sub(col_begin))),
|
||||
mark.repeat(cmp::max(1, col_end.saturating_sub(col_begin))),
|
||||
err_color,
|
||||
);
|
||||
} else if i == 0 {
|
||||
context.push_str(&" ".repeat(col_begin));
|
||||
context.push_str_with_color(
|
||||
&mark.repeat(cmp::max(1, codes[i].len().saturating_sub(col_begin))),
|
||||
mark.repeat(cmp::max(1, codes[i].len().saturating_sub(col_begin))),
|
||||
err_color,
|
||||
);
|
||||
} else if i == final_step {
|
||||
context.push_str_with_color(&mark.repeat(col_end), err_color);
|
||||
context.push_str_with_color(mark.repeat(col_end), err_color);
|
||||
} else {
|
||||
context.push_str_with_color(&mark.repeat(cmp::max(1, codes[i].len())), err_color);
|
||||
context.push_str_with_color(mark.repeat(cmp::max(1, codes[i].len())), err_color);
|
||||
}
|
||||
context.push_str("\n");
|
||||
}
|
||||
|
@ -609,9 +609,9 @@ fn format_context<E: ErrorDisplay + ?Sized>(
|
|||
context.push_str_with_color(&offset, gutter_color);
|
||||
context.push_str(&" ".repeat(col_end.saturating_sub(1)));
|
||||
if i == msg_num && hint.is_none() {
|
||||
context.push_str_with_color(&chars.left_bottom_line(), err_color);
|
||||
context.push_str_with_color(chars.left_bottom_line(), err_color);
|
||||
} else {
|
||||
context.push_str_with_color(&chars.left_cross(), err_color);
|
||||
context.push_str_with_color(chars.left_cross(), err_color);
|
||||
}
|
||||
context.push_str(msg);
|
||||
context.push_str("\n")
|
||||
|
@ -619,7 +619,7 @@ fn format_context<E: ErrorDisplay + ?Sized>(
|
|||
if let Some(hint) = hint {
|
||||
context.push_str_with_color(&offset, gutter_color);
|
||||
context.push_str(&" ".repeat(col_end.saturating_sub(1)));
|
||||
context.push_str_with_color(&chars.left_bottom_line(), err_color);
|
||||
context.push_str_with_color(chars.left_bottom_line(), err_color);
|
||||
context.push_str(hint);
|
||||
context.push_str("\n")
|
||||
}
|
||||
|
@ -751,7 +751,7 @@ impl SubMessage {
|
|||
gutter_color,
|
||||
);
|
||||
cxt.push_str(&" ".repeat(lineno.to_string().len()));
|
||||
cxt.push_str_with_color(&mark.repeat(cmp::max(1, codes[i].len())), err_color);
|
||||
cxt.push_str_with_color(mark.repeat(cmp::max(1, codes[i].len())), err_color);
|
||||
cxt.push_str("\n");
|
||||
}
|
||||
cxt.push_str("\n");
|
||||
|
|
|
@ -278,7 +278,7 @@ impl Input {
|
|||
|
||||
pub fn read(&mut self) -> String {
|
||||
match &mut self.kind {
|
||||
InputKind::File(filename) => match VFS.read(&filename) {
|
||||
InputKind::File(filename) => match VFS.read(filename.as_path()) {
|
||||
Ok(s) => s,
|
||||
Err(e) => {
|
||||
let code = e.raw_os_error().unwrap_or(1);
|
||||
|
@ -589,7 +589,7 @@ impl Input {
|
|||
/// 4. `{path/to}/__pycache__/__init__.d.er`
|
||||
/// 5. `{path.d/to.d}/__init__.d.er`
|
||||
/// 6. `{path.d/to.d}/__pycache__/__init__.d.er`
|
||||
/// (and repeat for the project root)
|
||||
/// * (and repeat for the project root)
|
||||
/// 7. `std/{path/to}.d.er`
|
||||
/// 8. `std/{path/to}/__init__.d.er`
|
||||
/// 9. `pkgs/{path/to}/src/lib.d.er`
|
||||
|
|
|
@ -852,7 +852,7 @@ pub fn _eval_pyc<S: Into<String>>(file: S, py_command: Option<&str>) -> String {
|
|||
Command::new("cmd")
|
||||
.arg("/C")
|
||||
.arg(command)
|
||||
.arg(&file.into())
|
||||
.arg(file.into())
|
||||
.spawn()
|
||||
.expect("cannot execute python")
|
||||
} else {
|
||||
|
|
|
@ -566,11 +566,6 @@ impl RegistrationMode {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
pub struct ContextInfo {
|
||||
mod_id: usize,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct MethodPair {
|
||||
definition_type: Type,
|
||||
|
|
|
@ -1207,7 +1207,7 @@ passed keyword args: {kw_args_len}"
|
|||
"traditional_chinese" => candidate.push_str("候選: "),
|
||||
"english" => candidate.push_str("candidates: "),
|
||||
);
|
||||
candidate.push_str_with_color_and_attr(&fmt_vec(candidates), WARN, ATTR);
|
||||
candidate.push_str_with_color_and_attr(fmt_vec(candidates), WARN, ATTR);
|
||||
Self::new(
|
||||
ErrorCore::new(
|
||||
vec![SubMessage::ambiguous_new(
|
||||
|
@ -1258,7 +1258,7 @@ passed keyword args: {kw_args_len}"
|
|||
"traditional_chinese" => candidate.push_str("候選: "),
|
||||
"english" => candidate.push_str("candidates: "),
|
||||
);
|
||||
candidate.push_str_with_color_and_attr(&fmt_vec(candidates), WARN, ATTR);
|
||||
candidate.push_str_with_color_and_attr(fmt_vec(candidates), WARN, ATTR);
|
||||
Self::new(
|
||||
ErrorCore::new(
|
||||
vec![SubMessage::ambiguous_new(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue