Skip to content

Commit

Permalink
Fix unneeded mutability
Browse files Browse the repository at this point in the history
The `#![cfg_attr(test, deny(warnings))]` caused CI failures from
`error: variable does not need to be mutable`, which would otherwise
just be a warning.  Every case here is simply binding a `&mut`, so the
variables themselves indeed don't need to be mutable.
  • Loading branch information
cuviper committed Sep 7, 2017
1 parent a852378 commit 2131b40
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/backtrack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ impl<'a, 'm, 'r, 's, I: Input> Bounded<'a, 'm, 'r, 's, I> {
start: usize,
) -> bool {
let mut cache = cache.borrow_mut();
let mut cache = &mut cache.backtrack;
let cache = &mut cache.backtrack;
let start = input.at(start);
let mut b = Bounded {
prog: prog,
Expand Down
6 changes: 3 additions & 3 deletions src/dfa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ impl<'a> Fsm<'a> {
at: usize,
) -> Result<usize> {
let mut cache = cache.borrow_mut();
let mut cache = &mut cache.dfa;
let cache = &mut cache.dfa;
let mut dfa = Fsm {
prog: prog,
start: 0, // filled in below
Expand Down Expand Up @@ -497,7 +497,7 @@ impl<'a> Fsm<'a> {
at: usize,
) -> Result<usize> {
let mut cache = cache.borrow_mut();
let mut cache = &mut cache.dfa_reverse;
let cache = &mut cache.dfa_reverse;
let mut dfa = Fsm {
prog: prog,
start: 0, // filled in below
Expand Down Expand Up @@ -531,7 +531,7 @@ impl<'a> Fsm<'a> {
) -> Result<usize> {
debug_assert!(matches.len() == prog.matches.len());
let mut cache = cache.borrow_mut();
let mut cache = &mut cache.dfa;
let cache = &mut cache.dfa;
let mut dfa = Fsm {
prog: prog,
start: 0, // filled in below
Expand Down
4 changes: 2 additions & 2 deletions src/pikevm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ impl<'r, I: Input> Fsm<'r, I> {
start: usize,
) -> bool {
let mut cache = cache.borrow_mut();
let mut cache = &mut cache.pikevm;
let cache = &mut cache.pikevm;
cache.clist.resize(prog.len(), prog.captures.len());
cache.nlist.resize(prog.len(), prog.captures.len());
let at = input.at(start);
Expand Down Expand Up @@ -341,7 +341,7 @@ impl<'r, I: Input> Fsm<'r, I> {
ip = inst.goto1;
}
Match(_) | Char(_) | Ranges(_) | Bytes(_) => {
let mut t = &mut nlist.caps(ip);
let t = &mut nlist.caps(ip);
for (slot, val) in t.iter_mut().zip(thread_caps.iter()) {
*slot = *val;
}
Expand Down

0 comments on commit 2131b40

Please sign in to comment.