Mark top-level items as pub(crate)

this way we'll get better compiler diagnostics (for example it'll warn
against unused fields and such).
This commit is contained in:
Maybe Waffle 2022-08-22 16:00:36 +04:00
parent b16256b8ea
commit 88449531a6
4 changed files with 12 additions and 12 deletions

View file

@ -3,7 +3,7 @@ use syn::{
LitStr, Token,
};
pub enum BotCommandAttribute {
pub(crate) enum BotCommandAttribute {
Prefix,
Description,
RenameRule,
@ -25,7 +25,7 @@ impl Parse for BotCommandAttribute {
}
}
pub struct Attr {
pub(crate) struct Attr {
name: BotCommandAttribute,
value: String,
}
@ -50,7 +50,7 @@ impl Attr {
}
}
pub struct VecAttrs {
pub(crate) struct VecAttrs {
pub data: Vec<Attr>,
}

View file

@ -66,11 +66,11 @@ impl Command {
}
pub(crate) struct CommandAttrs {
pub(crate) prefix: Option<String>,
pub(crate) description: Option<String>,
pub(crate) rename: Option<String>,
pub(crate) parser: Option<ParserType>,
pub(crate) separator: Option<String>,
pub prefix: Option<String>,
pub description: Option<String>,
pub rename: Option<String>,
pub parser: Option<ParserType>,
pub separator: Option<String>,
}
pub(crate) fn parse_attrs(attrs: &[Attr]) -> Result<CommandAttrs> {

View file

@ -4,7 +4,7 @@ use quote::{quote, ToTokens};
use syn::{FieldsNamed, FieldsUnnamed, Type};
#[derive(Debug)]
pub enum ParserType {
pub(crate) enum ParserType {
Default,
Split { separator: Option<String> },
Custom(String),
@ -20,7 +20,7 @@ impl ParserType {
}
}
pub fn impl_parse_args_unnamed(
pub(crate) fn impl_parse_args_unnamed(
data: &FieldsUnnamed,
variant: impl ToTokens,
parser_type: &ParserType,
@ -44,7 +44,7 @@ pub fn impl_parse_args_unnamed(
res
}
pub fn impl_parse_args_named(
pub(crate) fn impl_parse_args_named(
data: &FieldsNamed,
variant: impl ToTokens,
parser_type: &ParserType,

View file

@ -11,7 +11,7 @@ use heck::{
/// The possible `rule` can be: `lowercase`, `UPPERCASE`, `PascalCase`,
/// `camelCase`, `snake_case`, `SCREAMING_SNAKE_CASE`, `kebab-case`,
/// `SCREAMING-KEBAB-CASE`. See tests for the details how it will work.
pub fn rename_by_rule(input: &str, rule: &str) -> String {
pub(crate) fn rename_by_rule(input: &str, rule: &str) -> String {
match rule {
"lowercase" => input.to_lowercase(),
"UPPERCASE" => input.to_uppercase(),