Skip to content

Commit

Permalink
Removed uneeded mutability
Browse files Browse the repository at this point in the history
  • Loading branch information
expobrain committed Jun 25, 2018
1 parent 0424647 commit c183532
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions examples/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ fn main() {
map.insert(try!(usize::from_str(args[0])), args[1].to_string());
Ok(())
});
shell.new_command("get", "Get a value", 1, |mut io, map, args| {
shell.new_command("get", "Get a value", 1, |io, map, args| {
match map.get(&try!(usize::from_str(args[0]))) {
Some(val) => writeln!(io, "{}", val).unwrap(),
None => writeln!(io, "Not found").unwrap()
Expand All @@ -24,7 +24,7 @@ fn main() {
map.remove(&try!(usize::from_str(args[0])));
Ok(())
});
shell.new_command("list", "List all values", 0, |mut io, map, _| {
shell.new_command("list", "List all values", 0, |io, map, _| {
for (k, v) in map {
writeln!(io, "{} = {}", k, v).unwrap();
}
Expand Down
4 changes: 2 additions & 2 deletions examples/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ fn main() {
map.lock().unwrap().insert(try!(usize::from_str(args[0])), args[1].to_string());
Ok(())
});
shell.new_command("get", "Get a value", 1, |mut io, map, args| {
shell.new_command("get", "Get a value", 1, |io, map, args| {
match map.lock().unwrap().get(&try!(usize::from_str(args[0]))) {
Some(val) => writeln!(io, "{}", val).unwrap(),
None => writeln!(io, "Not found").unwrap()
Expand All @@ -30,7 +30,7 @@ fn main() {
map.lock().unwrap().remove(&try!(usize::from_str(args[0])));
Ok(())
});
shell.new_command("list", "List all values", 0, |mut io, map, _| {
shell.new_command("list", "List all values", 0, |io, map, _| {
for (k, v) in &*map.lock().unwrap() {
writeln!(io, "{} = {}", k, v).unwrap();
}
Expand Down

0 comments on commit c183532

Please sign in to comment.