Skip to content

Various improvements for test output#6822

Open
matthewhughes934 wants to merge 4 commits intorust-lang:mainfrom
matthewhughes934:misc-fixes
Open

Various improvements for test output#6822
matthewhughes934 wants to merge 4 commits intorust-lang:mainfrom
matthewhughes934:misc-fixes

Conversation

@matthewhughes934
Copy link

The main focus on this changeset is to reduce some noise that was
annoying me in test output (particularly in test failures)

There are still some compile errors outputted during tests (on failure
or with --nocapture due to doctests with compile_fail (there's an
open issue about this[1])

Link: rust-lang/rust#55813 [1]

  • Update docs for Session.format

    To stop referencing parameters out and config that were both moved
    into the Session object with 71d3d04

  • Move stray imports_granularity test

    Move this to be with all the other tests for this config option

  • Silence expected parser error

    I find otherwise the test output can be a bit noisy, and in particular
    the error messages make me think some test somewhere failed when even
    when it's all passing.

  • Remove warning on explicit default config value in tests

    This was added with f7a25a1, this was
    to address an issue with the worthy goal[1]:

    It is probably worth auditing the tests and where they are not
    deliberately testing an option, removing any options they set.

    However, given the number of warnings this produces:

    $ cargo test -- --nocapture |& grep -c 'Default value.*used explicitly'
    236
    

    I think this approach did not work, one could enforce this approach by
    changing this to be an error, but I think there are valid cases to use
    defaults, e.g. a reproduction of an issue relating to line length uses
    the default max_width: it's simplest to add a test verifying the
    behaviour with an explicit max_width: 100 rather than adjusting the
    reproduction.

    Link: improve test coverage for defaults #1720 [1]

To stop referencing parameters `out` and `config` that were both moved
into the `Session` object with 71d3d04
Move this to be with all the other tests for this config option
I find otherwise the test output can be a bit noisy, and in particular
the error messages make me think some test somewhere failed when even
when it's all passing.
This was added with f7a25a1, this was
to address an issue with the worthy goal[1]:

> It is probably worth auditing the tests and where they are not
deliberately testing an option, removing any options they set.

However, given the number of warnings this produces:

  $ cargo test -- --nocapture |& grep -c 'Default value.*used explicitly'
  236

I think this approach did not work, one could enforce this approach by
changing this to be an error, but I think there are valid cases to use
defaults, e.g. a reproduction of an issue relating to line length uses
the default `max_width`: it's simplest to add a test verifying the
behaviour with an explicit `max_width: 100` rather than adjusting the
reproduction.

Link: rust-lang#1720 [1]
@rustbot rustbot added the S-waiting-on-review Status: awaiting review from the assignee but also interested parties. label Mar 7, 2026
@ytmimi
Copy link
Contributor

ytmimi commented Mar 8, 2026

r? @ytmimi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants