Skip to content

Commit

Permalink
fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
limuy2022 committed May 12, 2024
1 parent 3c2b8d6 commit ee1e5b4
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/tools/tshell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ pub fn tshell() -> RuntimeResult<()> {
let _ast = compiler.lex()?;
// let mut vm = unsafe { Vm::new(&*(ast.prepare_get_static() as *const StaticData)) };
let _should_exit = false;
let _vm = todo!();
let _vm = 0;
todo!()
// let mut function_list = vec![];
// let mut function_defined_num = 0;
// 'stop_repl: loop {
Expand Down
12 changes: 9 additions & 3 deletions stdlib/src/ds/ac.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ impl AcAutomaton {
pub fn add_string(&mut self, addstring: &str) {
let mut u = 0;
for i in addstring.chars() {
if !self.states[u].next.contains_key(&i) {
let condit = !self.states[u].next.contains_key(&i);
if condit {
self.states.push(State::new());
let new_node_id = self.states.len() - 1;
self.states[u].next.insert(i, new_node_id);
Expand All @@ -48,8 +49,7 @@ impl AcAutomaton {
for i in self.states.first().unwrap().next.values() {
q.push(*i);
}
while !q.is_empty() {
let u = q.pop().unwrap();
while let Some(u) = q.pop() {
for (c, val) in &self.states[u].next.clone() {
// 在这里需要向上找到失配指针
// 正常的ac自动机会将剩余的失配部分也指向失配指针
Expand All @@ -74,6 +74,12 @@ impl AcAutomaton {
}
}

impl Default for AcAutomaton {
fn default() -> Self {
Self::new()
}
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down
6 changes: 6 additions & 0 deletions stdlib/src/ds/forward_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,9 @@ impl ForwardList {
self.size() == 0
}
}

impl Default for ForwardList {
fn default() -> Self {
Self::new()
}
}
6 changes: 6 additions & 0 deletions stdlib/src/ds/hash_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@ impl HashMap {
HashMap {}
}
}

impl Default for HashMap {
fn default() -> Self {
Self::new()
}
}
7 changes: 6 additions & 1 deletion stdlib/src/ds/splay.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

struct Node {
sons: [usize; 2],
cnt: usize,
Expand Down Expand Up @@ -37,6 +36,12 @@ impl Splay {
}
}

impl Default for Splay {
fn default() -> Self {
Self::new()
}
}

#[cfg(test)]
mod tests {
#[test]
Expand Down
6 changes: 6 additions & 0 deletions stdlib/src/ds/st.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@ impl StTable {
Self {}
}
}

impl Default for StTable {
fn default() -> Self {
Self::new()
}
}

0 comments on commit ee1e5b4

Please sign in to comment.