Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions src/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,13 +364,6 @@ fn set_preference_impl(name: &str, value: &str) -> Result<()> {
}
}

crate::speech::SPEECH_RULES.with(|rules| -> Result<()> {
if let Some(error_string) = rules.borrow().get_error() {
bail!("{}", error_string);
}
Ok(())
})?;

// Do not hold a SpeechRules borrow while updating preferences: invalidation clears rule caches.
let pref_manager = crate::prefs::PreferenceManager::get();
let mut pref_manager = pref_manager.borrow_mut();
Expand Down
13 changes: 0 additions & 13 deletions src/speech.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2101,11 +2101,7 @@ impl FilesAndTimes {

/// `SpeechRulesWithContext` encapsulates a named group of speech rules (e.g, "ClearSpeak")
/// along with the preferences to be used for speech.
// Note: if we can't read the files, an error message is stored in the structure and needs to be checked.
// I tried using Result<SpeechRules>, but it was a mess with all the unwrapping.
// Important: the code needs to be careful to check this at the top level calls
pub struct SpeechRules {
error: String,
name: RulesFor,
pub pref_manager: Rc<RefCell<PreferenceManager>>,
rules: RuleTable, // the speech rules used (partitioned into MathML tags in hashmap, then linearly searched)
Expand Down Expand Up @@ -2267,7 +2263,6 @@ impl SpeechRules {
};

return SpeechRules {
error: Default::default(),
name,
rules: HashMap::with_capacity(if name == RulesFor::Intent || name == RulesFor::Speech {500} else {50}), // lazy load them
rule_files: FilesAndTimes::default(),
Expand All @@ -2281,14 +2276,6 @@ impl SpeechRules {
};
}

pub fn get_error(&self) -> Option<&str> {
return if self.error.is_empty() {
None
} else {
Some(&self.error)
}
}

pub fn read_files(&mut self) -> Result<()> {
let check_rule_files = self.pref_manager.borrow().pref_to_string("CheckRuleFiles");
if check_rule_files != "None" { // "Prefs" or "All" are other values
Expand Down
Loading