summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Oram <dev@mitmaro.ca>2020-09-17 14:18:52 -0230
committerTim Oram <dev@mitmaro.ca>2020-09-17 21:39:31 -0230
commitc28be8e373daf7ff04a0470a67a8532139a4748c (patch)
treeddb482fc670db1ad82a6aec9e838149235804d27
parent64d0fa91533ce6a5a66a1a6502d2876772c2267f (diff)
Remove variable shadow in virtual_curses
-rw-r--r--src/display/virtual_curses.rs28
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> {