kdl-rs icon indicating copy to clipboard operation
kdl-rs copied to clipboard

Cannot easily format nodes if std::fmt::Display is in scope

Open dmerejkowsky opened this issue 3 years ago • 0 comments

Steps to reproduce:

use kdl::{KdlIdentifier, KdlNode};
use std::fmt::Display;   // <----- here!

fn main() {
    let mut section_node = KdlNode::new(KdlIdentifier::from("words"));
    section_node.fmt();
}

Error message:

error[E0061]: this function takes 1 argument but 0 arguments were supplied
   --> crates/core/src/config.rs:266:22
    |
266 |         section_node.fmt();
    |                      ^^^- supplied 0 arguments
    |                      |
    |                      expected 1 argument
    |
note: associated function defined here
   --> /home/dimitri/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/fmt/mod.rs:772:8
    |
772 |     fn fmt(&self, f: &mut Formatter<'_>) -> Result;
    |        ^^^

I think it would be best to rename fmt to auto_format or something like this

dmerejkowsky avatar Jul 21 '22 09:07 dmerejkowsky