some cleanng

master
Ondřej Hruška 5 years ago
parent 0ff10f5c45
commit bcfc006259
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 10
      src/animals.rs
  2. 2
      src/main.rs
  3. 1
      src/slot.rs

@ -1,8 +1,3 @@
use std::cell::Cell;
use std::cell::Ref;
use std::cell::RefCell;
use std::cell::RefMut;
use crate::slot::Slot;
use std::rc::Rc;
@ -44,6 +39,7 @@ impl AnimalDB {
}
}
#[allow(dead_code)]
pub fn enable_debug(&mut self, yes: bool) {
self.enable_debug = yes;
}
@ -84,7 +80,7 @@ impl AnimalDB {
drop(following); // must drop this lease, or .take() will panic
let old_animal = Rc::try_unwrap(updated_branch.take()).unwrap();
let mut new_q = NodeStruct {
let new_q = NodeStruct {
kind: NodeType::Question,
text: question,
branch_true: Slot::new(),
@ -98,7 +94,7 @@ impl AnimalDB {
user.notify_new_animal(&new_name);
let mut new_animal = NodeStruct {
let new_animal = NodeStruct {
kind: NodeType::Animal,
text: new_name,
branch_true: Slot::new(),

@ -94,7 +94,7 @@ macro_rules! map(
);
fn main() {
let mut db = animals::AnimalDB::new();
let db = animals::AnimalDB::new();
let duck = AnswerMachine {
answer: "duck".to_string(),

@ -8,6 +8,7 @@ pub struct Slot<T> {
v: RefCell<Option<Rc<T>>>,
}
#[allow(dead_code)] // some methods are unused, shut up the compiler
impl<T> Slot<T> {
/// Create a slot
///

Loading…
Cancel
Save