remove useless function argument in to_ansi

This commit is contained in:
mat 2021-12-10 21:56:57 +00:00
parent e4460661c6
commit 2ceaea5148
2 changed files with 5 additions and 5 deletions

View file

@ -195,8 +195,8 @@ impl Component {
.for_each(|s| Component::visit(s, f));
}
/// Convert this component into an ansi string, using parent_style as the running style.
pub fn to_ansi(&self, _: Option<()>) -> String {
/// Convert this component into an ansi string
pub fn to_ansi(&self) -> String {
// this contains the final string will all the ansi escape codes
let mut built_string = String::new();
// this style will update as we visit components

View file

@ -16,7 +16,7 @@ fn basic_ansi_test() {
.unwrap();
let component = Component::new(&j).unwrap();
assert_eq!(
component.to_ansi(None),
component.to_ansi(),
"\x1b[1m\x1b[38;2;255;85;85mhello\x1b[m"
);
}
@ -52,7 +52,7 @@ fn complex_ansi_test() {
.unwrap();
let component = Component::new(&j).unwrap();
assert_eq!(
component.to_ansi(None),
component.to_ansi(),
format!(
"{bold}{italic}{underlined}{red}hello{reset}{bold}{italic}{red} {reset}{italic}{strikethrough}{abcdef}world{reset}{abcdef} asdf{bold}!{reset}",
bold = Ansi::BOLD,
@ -70,5 +70,5 @@ fn complex_ansi_test() {
fn component_from_string() {
let j: Value = serde_json::from_str("\"foo\"").unwrap();
let component = Component::new(&j).unwrap();
assert_eq!(component.to_ansi(None), "foo");
assert_eq!(component.to_ansi(), "foo");
}