Skip to content

to_string and as_str have different implementations for Pair, which is pretty confusing and misleading #1149

@janTatesa

Description

@janTatesa

Describe the bug
When you do pair.to_string() and pair.as_str().to_string() you get different strings - the former gives the pair name and it's range, the latter the actual span content . This is pretty confusing as foo.as_str().to_string() should generally be equivalent to foo.to_string(). Users the library will think it is and it will lead to bugs. I personally did so and it wasn't pleasant to realize what was the cause

Expected behavior
pair.to_string() should produce the actual span content. There could be a different method for displaying the span name and range

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions