Skip to content

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

Closed
@dmerejkowsky

Description

@dmerejkowsky

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions