Skip to content

Commit fc38494

Browse files
committed
Be explicit about the oracle command.
1 parent f093ea5 commit fc38494

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

README.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,17 @@ now only need to be `pub(crate)`, `pub(super)`, or simply private.
99

1010
`depub` minimises the visibility of such items in files passed to it, using a
1111
user-specified command (e.g. `cargo check`) as an oracle to tell if its
12-
reduction of an item's visibility is valid or not. In essence, `depub` does a
13-
string search for `pub`, replaces it with `pub crate` and sees if a test
14-
command still succeeds. If it does, it keeps that visibility, otherwise it
15-
replaces with the original and tries the next item. Note that `depub` is
16-
inherently destructive: it overwrites files as it operates, so do not run it on
17-
source code that you do not want altered!
12+
reduction of an item's visibility is valid or not. Note that `depub` is
13+
entirely guided by the oracle command: if the code it compiles happens not to
14+
use part of an intentionally public interface, then `depub` is likely to
15+
suggest reducing its visibility even though that's what you want. The broader
16+
the coverage of your oracle, the less this is an issue.
17+
18+
In essence, `depub` does a string search for `pub`, replaces it with `pub
19+
crate` and sees if a test command still succeeds. If it does, it keeps that
20+
visibility, otherwise it replaces with the original and tries the next item.
21+
Note that `depub` is inherently destructive: it overwrites files as it
22+
operates, so do not run it on source code that you do not want altered!
1823

1924
The list of visibilities that `depub` considers is, in order: `pub`,
2025
`pub(crate)`, `pub(super)`, and private (i.e. no `pub` keyword at all). `depub`

0 commit comments

Comments
 (0)