What am I missing about not importing one's crate in its integration tests?

I was thinking to try to write a procedural macro, and I was looking at the source code of remain:

I notice that remain's tests in its top-level tests directory, what the Cargo book calls integration tests, don't explicitly import remain (or any other crate), which, as I thought, the Cargo book says they must:

Are the Cargo book and I outdated on this point, or is remain doing something else that I'm overlooking to have these tests declare their dependency on remain?

These tests are based on trybuild, which essentially treats each file in specified glob (here - in the ui directory) as independent subtest. In these subtests, remain is used as if it is an ordinary dependency.

(answered too hastily, fixing)

These tests use attribute macros like retain::check, importing them with their absolute path. Since the crate is using 2018 edition, that's enough, extern crate is unnecessary.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.