Skip to content

Commit

Permalink
output: get rid of an unsafe block (#1636)
Browse files Browse the repository at this point in the history
* parse: fix build in debug mode

This fixes a build failure in debug mode, as the value to be printed
does not implement Display.

* output: get rid of an unsafe block

This get rid of an unsafe block which is not necessary, and only used
when building in debug mode.
  • Loading branch information
lucab authored and Dylan-DPC committed Jan 17, 2020
1 parent af45420 commit f3683a9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
12 changes: 4 additions & 8 deletions src/output/help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -998,14 +998,10 @@ impl<'b, 'c, 'd, 'w> Help<'b, 'c, 'd, 'w> {
_ => continue,
};

debugln!("Help::write_template_help:iter: tag_buf={};", unsafe {
String::from_utf8_unchecked(
tag_buf.get_ref()[0..tag_length]
.iter()
.map(|&i| i)
.collect::<Vec<_>>(),
)
});
debugln!(
"Help::write_template_help:iter: tag_buf={};",
String::from_utf8_lossy(&tag_buf.get_ref()[0..tag_length])
);
match &tag_buf.get_ref()[0..tag_length] {
b"?" => {
self.writer.write_all(b"Could not decode tag name")?;
Expand Down
2 changes: 1 addition & 1 deletion src/parse/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ impl<'b, 'c, 'z> Validator<'b, 'c, 'z> {
self.p.app.color(),
));
debugln!(
"Validator::validate_conflicts_with_everything; ERROR: {}",
"Validator::validate_conflicts_with_everything; ERROR: {:?}",
err
);
return err;
Expand Down

0 comments on commit f3683a9

Please # to comment.