Skip to content

Commit

Permalink
Small doc fixes for the command macro
Browse files Browse the repository at this point in the history
And change to use the shorthand function for moving by n bytes.
  • Loading branch information
arqunis committed May 24, 2019
1 parent 10b9cc2 commit 186e914
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
8 changes: 4 additions & 4 deletions command_attr/src/lib.rs
Expand Up @@ -63,7 +63,7 @@ macro_rules! match_options {
/// - `#[checks(idents)]`
/// Preconditions that must be met. Executed before the command's execution.
/// `idents` is a list of identifiers, seperated by a comma, referencing functions of the declaration:
/// `fn(&mut Context, &Message, &mut Args, &CommandOptions) -> bool`
/// `fn(&mut Context, &Message, &mut Args, &CommandOptions) -> serenity::framework::standard::CheckResult`
///
/// - `#[aliases(names)]`
/// A list of other names that can be used to execute this command.
Expand All @@ -72,10 +72,10 @@ macro_rules! match_options {
/// - `#[description(desc)]`/`#[description = desc]`
/// A summary of the command.
///
/// - `#[usage(usg)]`/`#[usage = usg]
/// - `#[usage(usg)]`/`#[usage = usg]`
/// Usage schema of the command.
///
/// - `#[example(ex)]`/`#[example = ex]
/// - `#[example(ex)]`/`#[example = ex]`
/// Example of the command's usage.
///
/// - `#[min_args(min)]`, `#[max_args(max)]`, `#[num_args(min_and_max)]`
Expand All @@ -99,7 +99,7 @@ macro_rules! match_options {
/// - `#[owners_only]`/`#[owners_only(bool)]`
/// Whether this command is exclusive to owners.
///
/// - `#[owner_privilege]`/`#[owner_privilege]
/// - `#[owner_privilege]`/`#[owner_privilege]`
/// Whether this command has a privilege for owners (i.e certain options are ignored for them).
///
/// - `#[sub(commands)]`
Expand Down
9 changes: 3 additions & 6 deletions src/framework/standard/parse.rs
Expand Up @@ -58,8 +58,7 @@ pub fn parse_prefix<'a>(
}

if let Some(prefix) = prefix {
let pos = stream.offset();
stream.set(pos + prefix.len());
stream.increment(prefix.len());

if config.with_whitespace.prefixes {
stream.take_while(|s| s.is_whitespace());
Expand Down Expand Up @@ -128,8 +127,7 @@ impl<'msg, 'groups, 'config> CommandParser<'msg, 'groups, 'config> {
let equals = self.as_lowercase(n, |n| n == *name && !self.config.disabled_commands.contains(n));

if equals {
let pos = self.stream.offset();
self.stream.set(pos + n.len());
self.stream.increment(n.len());

if self.config.with_whitespace.commands {
self.stream.take_while(|s| s.is_whitespace());
Expand Down Expand Up @@ -157,8 +155,7 @@ impl<'msg, 'groups, 'config> CommandParser<'msg, 'groups, 'config> {
let pp = self.next_text(|| p.chars().count());

if *p == pp {
let pos = self.stream.offset();
self.stream.set(pos + pp.len());
self.stream.increment(pp.len());

if self.config.with_whitespace.groups {
self.stream.take_while(|s| s.is_whitespace());
Expand Down

0 comments on commit 186e914

Please sign in to comment.