Fix Clippy

This commit is contained in:
bakaq
2024-09-06 18:54:37 -03:00
parent d32f3ee2f3
commit 16734ec7e4
8 changed files with 37 additions and 39 deletions

View File

@@ -557,14 +557,14 @@ impl<'b> CodeGenerator<'b> {
match call_policy {
CallPolicy::Default => {
if self.marker.in_tail_position {
code.push_back(call_instr.to_execute().to_default());
code.push_back(call_instr.into_execute().into_default());
} else {
code.push_back(call_instr.to_default())
code.push_back(call_instr.into_default())
}
}
CallPolicy::Counted => {
if self.marker.in_tail_position {
code.push_back(call_instr.to_execute());
code.push_back(call_instr.into_execute());
} else {
code.push_back(call_instr)
}

View File

@@ -1194,11 +1194,8 @@ fn print_overwrite_warning(
key: PredicateKey,
is_dynamic: bool,
) {
if let CompilationTarget::Module(module_name) = compilation_target {
match module_name {
atom!("builtins") | atom!("loader") => return,
_ => {}
}
if let CompilationTarget::Module(atom!("builtins") | atom!("loader")) = compilation_target {
return;
}
match code_ptr.tag() {

View File

@@ -4611,11 +4611,11 @@ impl Machine {
self.shell();
step_or_fail!(self, self.machine_st.p = self.machine_st.cp);
}
&Instruction::CallPID => {
&Instruction::CallPid => {
self.pid();
step_or_fail!(self, self.machine_st.p += 1);
}
&Instruction::ExecutePID => {
&Instruction::ExecutePid => {
self.pid();
step_or_fail!(self, self.machine_st.p = self.machine_st.cp);
}

View File

@@ -213,8 +213,7 @@ impl<'a> HeapPStrIter<'a> {
self.brent_st.hare = orig_hare;
}
#[allow(clippy::inherent_to_string)]
pub fn to_string(&mut self) -> String {
pub fn to_string_mut(&mut self) -> String {
let mut buf = String::with_capacity(32);
for iteratee in self.by_ref() {

View File

@@ -1040,7 +1040,7 @@ impl MachineState {
self.heap.push(value);
let mut iter = HeapPStrIter::new(&self.heap, h);
let string = iter.to_string();
let string = iter.to_string_mut();
let at_terminator = iter.at_string_terminator();
self.heap.pop();

View File

@@ -26,6 +26,7 @@ pub type Specifier = u32;
pub const MAX_ARITY: usize = 1023;
#[allow(clippy::upper_case_acronyms)]
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
pub enum OpDeclSpec {
XFX = 0x0001,
@@ -660,7 +661,7 @@ impl fmt::Display for Literal {
}
impl Literal {
pub fn to_atom(&self, atom_tbl: &Arc<AtomTable>) -> Option<Atom> {
pub fn as_atom(&self, atom_tbl: &Arc<AtomTable>) -> Option<Atom> {
match self {
Literal::Atom(atom) => Some(atom.defrock_brackets(atom_tbl)),
_ => None,