Improve code and tests readability

This commit is contained in:
2020-07-11 17:47:28 +02:00
parent a8bafc072b
commit 8ddd33d76d
2 changed files with 18 additions and 13 deletions

View File

@@ -262,8 +262,10 @@ impl Settings {
/// # Example
///
/// ```
/// # use lang_evolve_core::settings::Settings;
/// use std::path::Path;
/// let s = lang_evolve_core::settings::Settings::new();
///
/// let s = Settings::new();
///
/// // Export to JSON
/// let path_json = Path::new("./output.json");
@@ -303,14 +305,14 @@ impl Settings {
let rules = self.rules.clone();
let rules: Vec<Rule> = rules
.iter()
.map(|x| x.update(&self.categories).unwrap())
.map(|rule| rule.update(&self.categories).unwrap())
.collect();
Ok(rules)
}
/// Apply list of rules to input
///
/// The list of rules in the struct will be applied to the input `s`. If the
/// The list of rules in the struct will be applied to the input `new`. If the
/// rule contains the `%` character followed by a capital letter, this marks
/// a category of phonemes and should be replaced by them. For instance, we
/// have:
@@ -320,7 +322,7 @@ impl Settings {
///
/// # Arguments
///
/// * `s` - Input to modify
/// * `new` - Input to modify
///
/// # Example
///
@@ -328,8 +330,8 @@ impl Settings {
/// # use lang_evolve_core::settings::Settings;
/// let settings = Settings::new();
/// // add some rules...
/// let input = String::new();
/// // set some input
/// let input = String::new();
/// let _output = settings.apply(input);
/// ```
pub fn apply(&self, s: String) -> std::result::Result<String, String> {