Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed string-delimiters, added Regex- and Itertools-crates, ... #134

Merged
merged 3 commits into from
Aug 13, 2017

Conversation

Lakelezz
Copy link
Contributor

... changed Delimeter-typo to Delimiter across the library

…elimeter-typo to Delimiter across the library
src/lib.rs Outdated
@@ -128,6 +128,9 @@ extern crate tokio_core;
extern crate typemap;
#[cfg(feature = "gateway")]
extern crate websocket;
#[cfg(feature = "framework")]
extern crate regex;
extern crate itertools;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feature-flag this as well

@hsiW hsiW added bug Something misbehaves or is not working. fix A solution to an existing bug. labels Aug 13, 2017

let regex = Regex::new(&regular_expression).unwrap();

let mut result: Vec<String> = vec![];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and the for loop can be changed to

regex.split(content)
    .filter_map(|p| if !p.is_empty() { Some(p.to_string()) } else { None })
    .collect::<Vec<_>>()

.map(|arg| arg.to_owned())
.collect::<Vec<String>>()
let delimiters = &self.configuration.delimiters;
let regular_expression = delimiters.iter().
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd look better (or less awkward) if you put this dot on the same line as map.

@arqunis arqunis merged commit 069df4f into serenity-rs:master Aug 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something misbehaves or is not working. fix A solution to an existing bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants