diff --git a/src/chemistry.rs b/src/chemistry.rs index 1266b408..1176d8d3 100644 --- a/src/chemistry.rs +++ b/src/chemistry.rs @@ -1258,15 +1258,6 @@ fn is_order_ok(mrow: Element) -> bool { } } -// from https://learnwithdrscott.com/ionic-bond-definition/ -// I don't include the noble gases since they don't interact with other elements and are ruled out elsewhere -// fn has_non_metal_element(elements: &[&str]) -> bool { -// static NON_METAL_ELEMENTS: phf::Set<&str> = phf_set! { -// "H", "B", "C", "N", "O", "F", "Si", "P", "S", "Cl", "As", "Se", "Br", "Te", "I", "At", -// }; -// return elements.iter().any(|&e| NON_METAL_ELEMENTS.contains(e)); -// } - fn has_noble_element(elements: &[NameStr<'_>]) -> bool { static NOBLE_ELEMENTS: phf::Set<&str> = phf_set! { diff --git a/src/pretty_print.rs b/src/pretty_print.rs index 67415794..6a3ccd97 100644 --- a/src/pretty_print.rs +++ b/src/pretty_print.rs @@ -4,15 +4,6 @@ use sxd_document_no_unsafe::dom::{Element, ChildOfElement, Attribute}; use sxd_document_no_unsafe::{as_str, as_qname}; -// #[allow(dead_code)] -// pub fn pp_doc(doc: &Document) { -// for root_child in doc.root().children() { -// if let ChildOfRoot::Element(e) = root_child { -// format_element(&e, 0); -// break; -// } -// }; -// } /// Pretty-print the MathML represented by `element`. pub fn mml_to_string(e: Element) -> String { @@ -89,23 +80,6 @@ fn handle_special_chars(text: &str) -> String { } -// /// Pretty print an xpath value. -// /// If the value is a `NodeSet`, the MathML for the node/element is returned. -// pub fn pp_xpath_value(value: Value) { -// use sxd_xpath_no_unsafe::Value; -// use sxd_xpath_no_unsafe::nodeset::Node; -// debug!("XPath value:"); -// if let Value::Nodeset(nodeset) = &value { -// for node in nodeset.document_order() { -// match node { -// Node::Element(el) => {debug!("{}", crate::pretty_print::format_element(&el, 1))}, -// Node::Text(t) => {debug!("found Text value: {}", t.text())}, -// _ => {debug!("found unexpected node type")} -// } -// } -// } -// } - /// Convert YAML to a string using with `indent` amount of space. pub fn yaml_to_string(yaml: &Yaml, indent: usize) -> String { let mut result = String::new(); @@ -288,12 +262,6 @@ impl<'a> YamlEmitter<'a> { self.compact } - // fn dump(&mut self, doc: &Yaml) -> EmitResult { - // // write DocumentStart - // writeln!(self.writer, "---")?; - // self.level = -1; - // self.emit_node(doc) - // } fn write_indent(&mut self) -> EmitResult { if self.level <= 0 { diff --git a/src/speech.rs b/src/speech.rs index faf4e69d..0b9b77bc 100644 --- a/src/speech.rs +++ b/src/speech.rs @@ -206,17 +206,6 @@ fn yaml_type_err(yaml: &Yaml, str: &str) -> Error { anyhow!("Expected {}, found {}", str, yaml_to_type(yaml)) } -// fn yaml_key_err(dict: &Yaml, key: &str, yaml_type: &str) -> String { -// if dict.as_hash().is_none() { -// return format!("Expected dictionary with key '{}', found\n{}", key, yaml_to_string(dict, 1)); -// } -// let str = &dict[key]; -// if str.is_badvalue() { -// return format!("Did not find '{}' in\n{}", key, yaml_to_string(dict, 1)); -// } -// return format!("Type of '{}' is not a {}.\nIt is a {}. YAML value is\n{}", -// key, yaml_type, yaml_to_type(str), yaml_to_string(dict, 0)); -// } fn find_str<'a>(dict: &'a Yaml, key: &'a str) -> Option<&'a str> { return dict[key].as_str();