mirror of
https://github.com/erg-lang/erg.git
synced 2025-09-29 12:24:45 +00:00
fix: warnings
This commit is contained in:
parent
93eb803ee3
commit
2709fffb4c
7 changed files with 23 additions and 23 deletions
|
@ -27,6 +27,6 @@ fn main() -> std::io::Result<()> {
|
|||
} else {
|
||||
true
|
||||
};
|
||||
println!("cargo:rustc-env=CASE_SENSITIVE={}", case_sensitive);
|
||||
println!("cargo:rustc-env=CASE_SENSITIVE={case_sensitive}");
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -1982,8 +1982,8 @@ pub enum GuardClause {
|
|||
impl NestedDisplay for GuardClause {
|
||||
fn fmt_nest(&self, f: &mut std::fmt::Formatter<'_>, _level: usize) -> std::fmt::Result {
|
||||
match self {
|
||||
GuardClause::Condition(cond) => write!(f, "{}", cond),
|
||||
GuardClause::Bind(bind) => write!(f, "{}", bind),
|
||||
GuardClause::Condition(cond) => write!(f, "{cond}"),
|
||||
GuardClause::Bind(bind) => write!(f, "{bind}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -642,14 +642,14 @@ impl CodeObj {
|
|||
write!(instrs, "{arg} ({})", self.cellvars[arg]).unwrap();
|
||||
}
|
||||
Opcode308::JUMP_ABSOLUTE => {
|
||||
write!(instrs, "{arg} (to {})", arg).unwrap();
|
||||
write!(instrs, "{arg} (to {arg})").unwrap();
|
||||
}
|
||||
Opcode308::JUMP_FORWARD => {
|
||||
write!(instrs, "{arg} (to {})", idx + arg + 2).unwrap();
|
||||
}
|
||||
// REVIEW: *2?
|
||||
Opcode308::POP_JUMP_IF_FALSE | Opcode308::POP_JUMP_IF_TRUE => {
|
||||
write!(instrs, "{arg} (to {})", arg).unwrap();
|
||||
write!(instrs, "{arg} (to {arg})").unwrap();
|
||||
}
|
||||
Opcode308::BINARY_ADD
|
||||
| Opcode308::BINARY_SUBTRACT
|
||||
|
@ -690,14 +690,14 @@ impl CodeObj {
|
|||
write!(instrs, "{arg} ({})", self.cellvars[arg]).unwrap();
|
||||
}
|
||||
Opcode309::JUMP_ABSOLUTE => {
|
||||
write!(instrs, "{arg} (to {})", arg).unwrap();
|
||||
write!(instrs, "{arg} (to {arg})").unwrap();
|
||||
}
|
||||
Opcode309::JUMP_FORWARD => {
|
||||
write!(instrs, "{arg} (to {})", idx + arg + 2).unwrap();
|
||||
}
|
||||
// REVIEW: *2?
|
||||
Opcode309::POP_JUMP_IF_FALSE | Opcode309::POP_JUMP_IF_TRUE => {
|
||||
write!(instrs, "{arg} (to {})", arg).unwrap();
|
||||
write!(instrs, "{arg} (to {arg})").unwrap();
|
||||
}
|
||||
Opcode309::BINARY_ADD
|
||||
| Opcode309::BINARY_SUBTRACT
|
||||
|
|
|
@ -183,12 +183,12 @@ pub fn try_v_enum(s: Set<ValueObj>) -> Result<Type, Set<ValueObj>> {
|
|||
}
|
||||
|
||||
pub fn v_enum(s: Set<ValueObj>) -> Type {
|
||||
try_v_enum(s).unwrap_or_else(|set| panic!("not homogeneous: {}", set))
|
||||
try_v_enum(s).unwrap_or_else(|set| panic!("not homogeneous: {set}"))
|
||||
}
|
||||
|
||||
pub fn t_enum(s: Set<Type>) -> Type {
|
||||
try_v_enum(s.into_iter().map(ValueObj::builtin_type).collect())
|
||||
.unwrap_or_else(|set| panic!("not homogeneous: {}", set))
|
||||
.unwrap_or_else(|set| panic!("not homogeneous: {set}"))
|
||||
}
|
||||
|
||||
pub fn t_singleton(t: Type) -> Type {
|
||||
|
|
|
@ -451,7 +451,7 @@ impl LimitedDisplay for SubrType {
|
|||
}
|
||||
write!(f, "*")?;
|
||||
if let Some(name) = var_params.name() {
|
||||
write!(f, "{}: ", name)?;
|
||||
write!(f, "{name}: ")?;
|
||||
}
|
||||
var_params.typ().limited_fmt(f, limit - 1)?;
|
||||
}
|
||||
|
|
|
@ -2162,19 +2162,19 @@ impl NestedDisplay for Call {
|
|||
if i != 0 {
|
||||
write!(f, ", ")?;
|
||||
}
|
||||
write!(f, "{}", arg)?;
|
||||
write!(f, "{arg}")?;
|
||||
}
|
||||
if let Some(rest) = self.args.var_args.as_ref() {
|
||||
if !self.args.pos_args().is_empty() {
|
||||
write!(f, ", ")?;
|
||||
}
|
||||
write!(f, "*{}", rest)?;
|
||||
write!(f, "*{rest}")?;
|
||||
}
|
||||
for (i, kw_arg) in self.args.kw_args().iter().enumerate() {
|
||||
if i != 0 || !self.args.pos_args().is_empty() || self.args.var_args.is_some() {
|
||||
write!(f, ", ")?;
|
||||
}
|
||||
write!(f, "{}", kw_arg)?;
|
||||
write!(f, "{kw_arg}")?;
|
||||
}
|
||||
write!(f, ")")
|
||||
} else {
|
||||
|
@ -3194,7 +3194,7 @@ impl NestedDisplay for ConstApp {
|
|||
fn fmt_nest(&self, f: &mut std::fmt::Formatter<'_>, level: usize) -> std::fmt::Result {
|
||||
writeln!(f, "{}", self.obj)?;
|
||||
if let Some(attr_name) = &self.attr_name {
|
||||
writeln!(f, "{}", attr_name)?;
|
||||
writeln!(f, "{attr_name}")?;
|
||||
}
|
||||
writeln!(f, "(")?;
|
||||
self.args.fmt_nest(f, level + 1)?;
|
||||
|
@ -4446,11 +4446,11 @@ impl fmt::Display for VarName {
|
|||
#[pymethods]
|
||||
impl VarName {
|
||||
pub fn __repr__(&self) -> String {
|
||||
format!("VarName({})", self)
|
||||
format!("VarName({self})")
|
||||
}
|
||||
|
||||
pub fn __str__(&self) -> String {
|
||||
format!("VarName({})", self)
|
||||
format!("VarName({self})")
|
||||
}
|
||||
|
||||
#[staticmethod]
|
||||
|
@ -4715,11 +4715,11 @@ impl From<Identifier> for Expr {
|
|||
#[pymethods]
|
||||
impl Identifier {
|
||||
pub fn __repr__(&self) -> String {
|
||||
format!("Identifier({})", self)
|
||||
format!("Identifier({self})")
|
||||
}
|
||||
|
||||
pub fn __str__(&self) -> String {
|
||||
format!("Identifier({})", self)
|
||||
format!("Identifier({self})")
|
||||
}
|
||||
|
||||
pub fn is_const(&self) -> bool {
|
||||
|
@ -5245,11 +5245,11 @@ impl VarSignature {
|
|||
}
|
||||
|
||||
pub fn __repr__(&self) -> String {
|
||||
format!("VarSignature({})", self)
|
||||
format!("VarSignature({self})")
|
||||
}
|
||||
|
||||
pub fn __str__(&self) -> String {
|
||||
format!("VarSignature({})", self)
|
||||
format!("VarSignature({self})")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5704,8 +5704,8 @@ pub enum GuardClause {
|
|||
impl NestedDisplay for GuardClause {
|
||||
fn fmt_nest(&self, f: &mut std::fmt::Formatter<'_>, _level: usize) -> std::fmt::Result {
|
||||
match self {
|
||||
Self::Condition(cond) => write!(f, "{}", cond),
|
||||
Self::Bind(def) => write!(f, "{}", def),
|
||||
Self::Condition(cond) => write!(f, "{cond}"),
|
||||
Self::Bind(def) => write!(f, "{def}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -454,7 +454,7 @@ impl PackageManagerRunner {
|
|||
{
|
||||
Ok(out) => ExitStatus::new(out.status.code().unwrap_or(0), 0, 0),
|
||||
Err(err) => {
|
||||
eprintln!("Error: {}", err);
|
||||
eprintln!("Error: {err}");
|
||||
ExitStatus::ERR1
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue