aboutsummaryrefslogtreecommitdiff
path: root/src/framework
diff options
context:
space:
mode:
authorLakelezz <[email protected]>2018-09-21 22:41:36 +0200
committerGitHub <[email protected]>2018-09-21 22:41:36 +0200
commite763d80b7697f92e84c2d84ace5ea9fc50a9f9f0 (patch)
tree03071b18ce57a84b575482635cef102b8e965768 /src/framework
parentBe able to trim whitespace (diff)
downloadserenity-e763d80b7697f92e84c2d84ace5ea9fc50a9f9f0.tar.xz
serenity-e763d80b7697f92e84c2d84ace5ea9fc50a9f9f0.zip
Make `trim` return `&mut self` (#395)
Diffstat (limited to 'src/framework')
-rw-r--r--src/framework/standard/args.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/framework/standard/args.rs b/src/framework/standard/args.rs
index 036db7a..6841bd7 100644
--- a/src/framework/standard/args.rs
+++ b/src/framework/standard/args.rs
@@ -357,15 +357,16 @@ impl Args {
///
/// let mut args = Args::new(" 42 ", &[]);
///
- /// args.trim();
- /// assert_eq!(args.current(), Some("42"));
+ /// assert_eq!(args.trim().current(), Some("42"));
/// ```
- pub fn trim(&mut self) {
+ pub fn trim(&mut self) -> &mut Self {
if self.is_empty() {
- return;
+ return self;
}
self.args[self.offset].lit = self.args[self.offset].lit.trim().to_string();
+
+ self
}
/// Trims all of the arguments after the offset off leading and trailing whitespace.