Skip to content

Commit

Permalink
make Array::get be &self, not &mut self
Browse files Browse the repository at this point in the history
The &mut isn't required.
  • Loading branch information
sunshowers committed Jun 18, 2020
1 parent 520bfe2 commit 85372f7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,9 @@ impl Array {
self.push_value(v.into(), true)
}

/// Return an optional reference to the value at the given index.
pub fn get(&mut self, index: usize) -> Option<&Value> {
/// Returns a reference to the value at the given index, or `None` if the index is out of
/// bounds.
pub fn get(&self, index: usize) -> Option<&Value> {
self.values.get(index).and_then(Item::as_value)
}

Expand Down

0 comments on commit 85372f7

Please sign in to comment.