Skip to content

Commit

Permalink
Make trim return &mut self (#395)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lakelezz committed Sep 21, 2018
1 parent 3b050f4 commit e763d80
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/framework/standard/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit e763d80

Please sign in to comment.