Skip to content

Commit

Permalink
Fix clippy where applicable
Browse files Browse the repository at this point in the history
  • Loading branch information
nabijaczleweli committed Feb 26, 2020
1 parent ddf9304 commit 4461e92
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/binutils/pir_8_as/directive/directive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ impl<'s> AssemblerDirective<'s> {
}
AssemblerDirective::SaveLabel(lbl) => {
if !labels.contains_key(*lbl) {
labels.insert(lbl.to_string(),
labels.insert((*lbl).to_string(),
if let Some(&oa) = next_output_address.as_ref() {
oa
} else {
Expand All @@ -128,7 +128,7 @@ impl<'s> AssemblerDirective<'s> {
}
AssemblerDirective::LoadLabel(lbl, offset, fragment) => {
match labels.get(*lbl) {
None => Ok(Some(Ok(LabelLoad::WaitFor(lbl.to_string(), *offset, *fragment)))),
None => Ok(Some(Ok(LabelLoad::WaitFor((*lbl).to_string(), *offset, *fragment)))),
Some(&addr) => {
Ok(Some(Ok(LabelLoad::HaveImmediately(if *offset < 0 {
addr.wrapping_sub(-*offset as u16)
Expand Down
2 changes: 1 addition & 1 deletion src/binutils/pir_8_as/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl LabelFragment {
/// assert_eq!(LabelFragment::Full.len(), 2);
/// assert_eq!(LabelFragment::High.len(), 1);
/// ```
pub fn len(&self) -> u8 {
pub fn len(self) -> u8 {
match self {
LabelFragment::Full => 2,
LabelFragment::High | LabelFragment::Low => 1,
Expand Down
4 changes: 2 additions & 2 deletions src/binutils/pir_8_as/output_with_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ impl OutputWithQueue {
/// This repeats until the queue is empty or the label thereatfront doesn't exist in the labelset
pub fn flush(&mut self, labels: &BTreeMap<String, u16>) -> io::Result<()> {
while !self.buffer.is_empty() {
if self.buffer[0].write_if_ready(&mut self.phys_out, labels)? {
if self.buffer[0].write_if_ready(self.phys_out.as_mut(), labels)? {
self.buffer.pop_front();
} else {
break;
Expand Down Expand Up @@ -133,7 +133,7 @@ impl BufferedData {
}
}

pub fn write_if_ready(&self, to: &mut Box<dyn Write>, labels: &BTreeMap<String, u16>) -> io::Result<bool> {
pub fn write_if_ready(&self, to: &mut dyn Write, labels: &BTreeMap<String, u16>) -> io::Result<bool> {
match labels.get(&self.label) {
Some(addr) => {
let addr = if self.offset < 0 {
Expand Down
4 changes: 2 additions & 2 deletions src/micro/perform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ fn s_reg_flags(s: u8) -> u8 {
}

fn push_address(stack: &mut Vec<u8>, address: u16) {
let high_byte = ((address >> 8) & 0xFF) as u8;
let low_byte = ((address >> 0) & 0xFF) as u8;
let high_byte = (address >> 8) as u8;
let low_byte = (address & 0xFF) as u8;

stack.push(high_byte);
stack.push(low_byte);
Expand Down

0 comments on commit 4461e92

Please sign in to comment.