Skip to content

Some no-listing listings are substantially different from main listings #4555

@NeatNit

Description

@NeatNit
  • I have searched open and closed issues and pull requests for duplicates, using these search terms:
    • "no-listing"
  • I have checked the latest main branch to see if this has already been fixed

As I mentioned in #4554, in Chapter 12 and almost certainly in other chapters, code from no-listing and output-only listings is different from the code in proper listings, which seems unintended. For example: in Chapter 12 listings, struct Config and fn run are defined and implemented in main.rs. However, in these "non-listings" they are defined in lib.rs.

no-listing-02-using-search-in-run/src/lib.rs
output-only-03-multiple-matches/src/lib.rs
output-only-04-no-matches/src/lib.rs

The code for these non-listings is included in the listings.tar.gz file in the releases, so this issue is technically user-facing.

Ideally, tests can be implemented that ensure each listing or non-listing differs from the previous listing in only the ways intended by the book's text. This way, future changes to the listings would trigger test fails that would prompt to update the dependent listings as well.

Of course, writing such tests might be more trouble than it's worth, but if it's done smartly perhaps it can become part of mdbook and not just TRPL.

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