From b6101184537b1165cfdd5fc473e04ad4c5b7bffa Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 2 Nov 2020 13:13:32 +0100 Subject: Deny unreachable-pub It's very useful when `pub` is equivalent to "this is crate's public API", let's enforce this! Ideally, we should enforce it for local `cargo test`, and only during CI, but that needs https://github.com/rust-lang/cargo/issues/5034. --- crates/mbe/src/mbe_expander/matcher.rs | 10 +++++----- crates/mbe/src/subtree_source.rs | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'crates/mbe') diff --git a/crates/mbe/src/mbe_expander/matcher.rs b/crates/mbe/src/mbe_expander/matcher.rs index b698b9832..39a8eefbd 100644 --- a/crates/mbe/src/mbe_expander/matcher.rs +++ b/crates/mbe/src/mbe_expander/matcher.rs @@ -61,16 +61,16 @@ macro_rules! err { #[derive(Debug, Default)] pub(super) struct Match { - pub bindings: Bindings, + pub(super) bindings: Bindings, /// We currently just keep the first error and count the rest to compare matches. - pub err: Option, - pub err_count: usize, + pub(super) err: Option, + pub(super) err_count: usize, /// How many top-level token trees were left to match. - pub unmatched_tts: usize, + pub(super) unmatched_tts: usize, } impl Match { - pub fn add_err(&mut self, err: ExpandError) { + pub(super) fn add_err(&mut self, err: ExpandError) { let prev_err = self.err.take(); self.err = prev_err.or(Some(err)); self.err_count += 1; diff --git a/crates/mbe/src/subtree_source.rs b/crates/mbe/src/subtree_source.rs index 396ce8b16..38237cdcf 100644 --- a/crates/mbe/src/subtree_source.rs +++ b/crates/mbe/src/subtree_source.rs @@ -7,9 +7,9 @@ use tt::buffer::{Cursor, TokenBuffer}; #[derive(Debug, Clone, Eq, PartialEq)] struct TtToken { - pub kind: SyntaxKind, - pub is_joint_to_next: bool, - pub text: SmolStr, + kind: SyntaxKind, + is_joint_to_next: bool, + text: SmolStr, } pub(crate) struct SubtreeTokenSource<'a> { @@ -30,7 +30,7 @@ impl<'a> SubtreeTokenSource<'a> { } impl<'a> SubtreeTokenSource<'a> { - pub fn new(buffer: &'a TokenBuffer) -> SubtreeTokenSource<'a> { + pub(crate) fn new(buffer: &'a TokenBuffer) -> SubtreeTokenSource<'a> { let cursor = buffer.begin(); let mut res = SubtreeTokenSource { -- cgit v1.2.3