diff options
author | Tim Oram <dev@mitmaro.ca> | 2020-09-17 14:18:52 -0230 |
---|---|---|
committer | Tim Oram <dev@mitmaro.ca> | 2020-09-17 21:39:31 -0230 |
commit | c28be8e373daf7ff04a0470a67a8532139a4748c (patch) | |
tree | ddb482fc670db1ad82a6aec9e838149235804d27 | |
parent | 64d0fa91533ce6a5a66a1a6502d2876772c2267f (diff) |
Remove variable shadow in virtual_curses
-rw-r--r-- | src/display/virtual_curses.rs | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/src/display/virtual_curses.rs b/src/display/virtual_curses.rs index 375f068..4f88287 100644 --- a/src/display/virtual_curses.rs +++ b/src/display/virtual_curses.rs @@ -94,29 +94,27 @@ impl Curses { } pub(super) fn attrset<T: Into<chtype>>(&self, attributes: T) { - let attributes = attributes.into(); + let attrs = attributes.into(); self.function_call_trace .borrow_mut() - .push(build_trace!("attrset", attributes)); - self.attributes.replace(attributes); + .push(build_trace!("attrset", attrs)); + self.attributes.replace(attrs); } - pub(super) fn attron<T: Into<chtype>>(&self, attributes: T) { - let attributes = attributes.into(); - self.function_call_trace - .borrow_mut() - .push(build_trace!("attron", attributes)); - let attr = *self.attributes.borrow(); - self.attributes.replace(attr | attributes); + pub(super) fn attron<T: Into<chtype>>(&self, attribute: T) { + let attr = attribute.into(); + let old_attr = *self.attributes.borrow(); + self.function_call_trace.borrow_mut().push(build_trace!("attron", attr)); + self.attributes.replace(old_attr | attr); } - pub(super) fn attroff<T: Into<chtype>>(&self, attributes: T) { - let attributes = attributes.into(); + pub(super) fn attroff<T: Into<chtype>>(&self, attribute: T) { + let attr = attribute.into(); + let old_attr = *self.attributes.borrow(); self.function_call_trace .borrow_mut() - .push(build_trace!("attroff", attributes)); - let attr = *self.attributes.borrow(); - self.attributes.replace(attr & !attributes); + .push(build_trace!("attroff", attr)); + self.attributes.replace(old_attr & !attr); } pub(super) fn getch(&self) -> Option<Input> { |