Skip to content

Commit 6d07247

Browse files
committed
Reduce the visibility of most submodules of matchers.
This reduces the number of public paths to each of the matcher functions. The functions are now visible only from the `matchers` module, and submodules containing those functions no longer appear in published documentation. Submodules containing macros which construct matchers remain public, since downstream crates still depend on these. This also reduces the visibility of some matcher structs which do not need to be public. Their constructor functions return `impl Matcher` and they provide no additional methods.
1 parent 7c0c2c9 commit 6d07247

File tree

4 files changed

+40
-38
lines changed

4 files changed

+40
-38
lines changed

googletest/src/matchers/ge_matcher.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ pub fn ge<ActualT: Debug + PartialOrd<ExpectedT>, ExpectedT: Debug>(
7777
GeMatcher::<ActualT, _> { expected, phantom: Default::default() }
7878
}
7979

80-
pub struct GeMatcher<ActualT, ExpectedT> {
80+
struct GeMatcher<ActualT, ExpectedT> {
8181
expected: ExpectedT,
8282
phantom: PhantomData<ActualT>,
8383
}

googletest/src/matchers/le_matcher.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ pub fn le<ActualT: Debug + PartialOrd<ExpectedT>, ExpectedT: Debug>(
7777
LeMatcher::<ActualT, _> { expected, phantom: Default::default() }
7878
}
7979

80-
pub struct LeMatcher<ActualT, ExpectedT> {
80+
struct LeMatcher<ActualT, ExpectedT> {
8181
expected: ExpectedT,
8282
phantom: PhantomData<ActualT>,
8383
}

googletest/src/matchers/lt_matcher.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ pub fn lt<ActualT: Debug + PartialOrd<ExpectedT>, ExpectedT: Debug>(
7777
LtMatcher::<ActualT, _> { expected, phantom: Default::default() }
7878
}
7979

80-
pub struct LtMatcher<ActualT, ExpectedT> {
80+
struct LtMatcher<ActualT, ExpectedT> {
8181
expected: ExpectedT,
8282
phantom: PhantomData<ActualT>,
8383
}

googletest/src/matchers/mod.rs

Lines changed: 37 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -16,56 +16,56 @@
1616
1717
pub mod all_matcher;
1818
pub mod any_matcher;
19-
pub mod anything_matcher;
20-
pub mod char_count_matcher;
19+
mod anything_matcher;
20+
mod char_count_matcher;
2121
pub mod conjunction_matcher;
22-
pub mod container_eq_matcher;
23-
pub mod contains_matcher;
24-
pub mod contains_regex_matcher;
22+
mod container_eq_matcher;
23+
mod contains_matcher;
24+
mod contains_regex_matcher;
2525
pub mod disjunction_matcher;
26-
pub mod display_matcher;
27-
pub mod each_matcher;
26+
mod display_matcher;
27+
mod each_matcher;
2828
pub mod elements_are_matcher;
29-
pub mod empty_matcher;
30-
pub mod eq_deref_of_matcher;
31-
pub mod eq_matcher;
32-
pub mod err_matcher;
29+
mod empty_matcher;
30+
mod eq_deref_of_matcher;
31+
mod eq_matcher;
32+
mod err_matcher;
3333
pub mod field_matcher;
34-
pub mod ge_matcher;
35-
pub mod gt_matcher;
36-
pub mod has_entry_matcher;
34+
mod ge_matcher;
35+
mod gt_matcher;
36+
mod has_entry_matcher;
3737
pub mod is_matcher;
38-
pub mod is_nan_matcher;
39-
pub mod le_matcher;
40-
pub mod len_matcher;
41-
pub mod lt_matcher;
42-
pub mod matches_pattern;
43-
pub mod matches_regex_matcher;
44-
pub mod near_matcher;
45-
pub mod none_matcher;
46-
pub mod not_matcher;
47-
pub mod ok_matcher;
48-
pub mod points_to_matcher;
38+
mod is_nan_matcher;
39+
mod le_matcher;
40+
mod len_matcher;
41+
mod lt_matcher;
42+
mod matches_pattern;
43+
mod matches_regex_matcher;
44+
mod near_matcher;
45+
mod none_matcher;
46+
mod not_matcher;
47+
mod ok_matcher;
48+
mod points_to_matcher;
4949
pub mod pointwise_matcher;
50-
pub mod predicate_matcher;
50+
mod predicate_matcher;
5151
pub mod property_matcher;
52-
pub mod some_matcher;
53-
pub mod str_matcher;
54-
pub mod subset_of_matcher;
55-
pub mod superset_of_matcher;
56-
pub mod tuple_matcher;
52+
mod some_matcher;
53+
mod str_matcher;
54+
mod subset_of_matcher;
55+
mod superset_of_matcher;
56+
mod tuple_matcher;
5757
pub mod unordered_elements_are_matcher;
5858

5959
pub use anything_matcher::anything;
6060
pub use char_count_matcher::char_count;
6161
pub use container_eq_matcher::container_eq;
62-
pub use contains_matcher::contains;
62+
pub use contains_matcher::{contains, ContainsMatcher};
6363
pub use contains_regex_matcher::contains_regex;
6464
pub use display_matcher::displays_as;
6565
pub use each_matcher::each;
6666
pub use empty_matcher::empty;
6767
pub use eq_deref_of_matcher::eq_deref_of;
68-
pub use eq_matcher::eq;
68+
pub use eq_matcher::{eq, EqMatcher};
6969
pub use err_matcher::err;
7070
pub use ge_matcher::ge;
7171
pub use gt_matcher::gt;
@@ -75,13 +75,15 @@ pub use le_matcher::le;
7575
pub use len_matcher::len;
7676
pub use lt_matcher::lt;
7777
pub use matches_regex_matcher::matches_regex;
78-
pub use near_matcher::{approx_eq, near};
78+
pub use near_matcher::{approx_eq, near, NearMatcher};
7979
pub use none_matcher::none;
8080
pub use not_matcher::not;
8181
pub use ok_matcher::ok;
8282
pub use points_to_matcher::points_to;
8383
pub use predicate_matcher::{predicate, PredicateMatcher};
8484
pub use some_matcher::some;
85-
pub use str_matcher::{contains_substring, ends_with, starts_with, StrMatcherConfigurator};
85+
pub use str_matcher::{
86+
contains_substring, ends_with, starts_with, StrMatcher, StrMatcherConfigurator,
87+
};
8688
pub use subset_of_matcher::subset_of;
8789
pub use superset_of_matcher::superset_of;

0 commit comments

Comments
 (0)