Skip to content

chore(test): Remove unused header includes in test files#4729

Merged
vitaut merged 1 commit intofmtlib:mainfrom
KaganCanSit:chore/iwyu-remove-unused-test-headers
Apr 6, 2026
Merged

chore(test): Remove unused header includes in test files#4729
vitaut merged 1 commit intofmtlib:mainfrom
KaganCanSit:chore/iwyu-remove-unused-test-headers

Conversation

@KaganCanSit
Copy link
Copy Markdown
Contributor

@KaganCanSit KaganCanSit commented Apr 3, 2026

Remove header includes that are not directly used in their respective translation units. Identified through manual code review assisted by IWYU (Include What You Use).

I’m not entirely familiar with the project code. For that reason, I’ve stayed out of the include and src directories as much as possible.

I compile, test and format it using the commands below, everything seems to be working fine (All 20 test pass). However, I’ll check it in CI.

rm -rf build
cmake -S . -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DFMT_TEST=ON
cmake --build build
cd build && ctest
clang-format -i test/chrono-test.cc test/format-impl-test.cc test/format-test.cc test/gtest-extra-test.cc test/printf-test.cc test/os-test.cc test/ranges-test.cc test/scan-test.cc test/xchar-test.cc

Note: I labeled this as chore rather than refactor since these changes are closer to maintenance. Happy to update the title or label if you prefer something different.

Please leave a comment if there’s anything you’d like me to adjust. I’ll look into it when I have a chance.

@KaganCanSit
Copy link
Copy Markdown
Contributor Author

KaganCanSit commented Apr 3, 2026

The clang-format CI check is reporting an error in the include/fmt/base.h file, but this has nothing to do with the changes in this PR. The file was not modified here. (I am currently using clang-format 19.1.7 on the Debian 13 Trixie distribution.)

I’m not entirely sure, but the error might be caused by the Fuzzer project’s default branch name being changed from master to main. -> https://github.com/google/oss-fuzz/blob/master/projects/fmt/Dockerfile

#9 [5/7] RUN git clone --depth 1 --branch master 

@vitaut
Copy link
Copy Markdown
Contributor

vitaut commented Apr 4, 2026

The clang-format issue is fixed in main, you can ignore lint and oss-fuzz failures.

@KaganCanSit KaganCanSit force-pushed the chore/iwyu-remove-unused-test-headers branch from 9c3e7ee to 88cb3a5 Compare April 4, 2026 08:51
@KaganCanSit
Copy link
Copy Markdown
Contributor Author

Thanks for the information. I’ve rebased to the main branch. This should resolve the Clang formatting error. If any other changes wants I'm here.

@vitaut vitaut merged commit 9396f77 into fmtlib:main Apr 6, 2026
44 of 45 checks passed
@vitaut
Copy link
Copy Markdown
Contributor

vitaut commented Apr 6, 2026

Merged, thank you!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants