Skip to content
Merged
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
26 changes: 10 additions & 16 deletions src/tts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,16 +243,6 @@ impl fmt::Display for TTSCommandRule {
}


impl TTSCommandRule {
pub fn new(command: TTSCommand, value: TTSCommandValue, replacements: ReplacementArray) -> TTSCommandRule {
return TTSCommandRule{
command,
value,
replacements
}
}
}

/// Supported TTS engines
/// These types should do something for all the TTSCommands
#[allow(clippy::upper_case_acronyms)]
Expand Down Expand Up @@ -348,7 +338,11 @@ impl TTS {
TTSCommandValue::String(tts_str_value.to_string())
},
};
return Ok( Box::new( TTSCommandRule::new(tts_enum, tts_command_value, replacements) ) );
return Ok(Box::new(TTSCommandRule {
command: tts_enum,
value: tts_command_value,
replacements,
}));
}

/// The rule called to execute the TTSCommand `command`
Expand Down Expand Up @@ -691,11 +685,11 @@ impl TTS {
}
let pause = std::cmp::min(3000, ((2 * before_len + after_len)/48) * 128);
// create a TTSCommandRule so we reuse code
let command = TTSCommandRule::new(
TTSCommand::Pause,
TTSCommandValue::Number(pause as f64),
ReplacementArray::build_empty(),
);
let command = TTSCommandRule {
command: TTSCommand::Pause,
value: TTSCommandValue::Number(pause as f64),
replacements: ReplacementArray::build_empty(),
};
return match self {
TTS::None => self.get_string_none(&command, prefs, true),
TTS::SSML => self.get_string_ssml(&command, prefs, true),
Expand Down
Loading