Teacup rim text: Difference between revisions

m
Simplified Rust code
m (Minor edit)
m (Simplified Rust code)
Line 1,445:
use std::fs::File;
use std::io::{self, BufRead};
use std::iter::FromIterator;
 
fn load_dictionary(filename : &str) -> std::io::Result<BTreeSet<String>> {
Line 1,467 ⟶ 1,468:
teacup_words.clear();
let mut is_teacup_word = true;
let mut byteschars : Vec<char> = word.as_byteschars().to_veccollect();
for _ in 1..len {
byteschars.rotate_left(1);
matchlet w = String::from_utf8(bytes.to_vecfrom_iter(&chars)) {;
if Ok!dict.contains(&w) => {
is_teacup_word = if !dict.contains(&w) {false;
is_teacup_word = falsebreak;
break;}
if !w.eq(word) && !teacup_words.contains(&w) }{
if !w.eq(word) && !teacup_words.containspush(&w) {;
teacup_words.push(w);
}
},
Err(_) => {
is_teacup_word = false;
break;
}
}
}
1,777

edits