Skip to content

Commit

Permalink
Fix (work-around) compiler issue when using decode::Name in a match.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Bruijnzeels committed Jan 27, 2022
1 parent 0124bbe commit 021bbb3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 20 deletions.
16 changes: 6 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,12 @@ jobs:
# Only do this once with all features enabled.
# Only do Clippy on stable for the moment, due to
# clippy::unknown_clippy_lints being removed.
#
# Disabling clippy for the moment. See this issue:
# https://github.com/rust-lang/rust-clippy/issues/8357https://github.com/rust-lang/rust-clippy/issues/8357
#
# - if: matrix.rust == 'stable'
# run: rustup component add clippy
# - if: matrix.os != 'windows-latest' && matrix.rust == 'stable'
# run: cargo clippy --all --all-features -- -D warnings
# - if: matrix.os == 'windows-latest' && matrix.rust == 'stable'
# run: cargo clippy --all --features __windows_ci_all -- -D warnings
- if: matrix.rust == 'stable'
run: rustup component add clippy
- if: matrix.os != 'windows-latest' && matrix.rust == 'stable'
run: cargo clippy --all --all-features -- -D warnings
- if: matrix.os == 'windows-latest' && matrix.rust == 'stable'
run: cargo clippy --all --features __windows_ci_all -- -D warnings

# Build
- if: matrix.os != 'windows-latest'
Expand Down
23 changes: 13 additions & 10 deletions src/remote/publication.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,12 @@ const QUERY_PDU_LIST: Name = Name::qualified(NS, b"list");
const QUERY_PDU_PUBLISH: Name = Name::qualified(NS, b"publish");
const QUERY_PDU_WITHDRAW: Name = Name::qualified(NS, b"withdraw");

const REPLY_PDU_LIST: Name = Name::qualified(NS, b"list");
const REPLY_PDU_SUCCESS: Name = Name::qualified(NS, b"success");
const REPLY_PDU_ERROR: Name = Name::qualified(NS, b"report_error");
const LIST_LOCAL: &[u8] = b"list";
const LIST: Name = Name::qualified(NS, LIST_LOCAL);
const SUCCESS_LOCAL: &[u8] = b"success";
const SUCCESS: Name = Name::qualified(NS, SUCCESS_LOCAL);
const REPORT_ERROR_LOCAL: &[u8] = b"report_error";
const REPORT_ERROR: Name = Name::qualified(NS, REPORT_ERROR_LOCAL);

const REPLY_PDU_ERROR_TEXT: Name = Name::qualified(NS, b"error_text");
const REPLY_PDU_ERROR_PDU: Name = Name::qualified(NS, b"failed_pdu");
Expand Down Expand Up @@ -600,10 +603,10 @@ impl ReplyMessage {

let pdu_element = content.take_opt_element(reader, |element| {
// Determine the PDU type
pdu_type = Some(match element.name() {
REPLY_PDU_LIST => Ok(ReplyPduType::List),
REPLY_PDU_SUCCESS => Ok(ReplyPduType::Success),
REPLY_PDU_ERROR => Ok(ReplyPduType::Error),
pdu_type = Some(match element.name().local() {
LIST_LOCAL => Ok(ReplyPduType::List),
SUCCESS_LOCAL => Ok(ReplyPduType::Success),
REPORT_ERROR_LOCAL => Ok(ReplyPduType::Error),
_ => Err(XmlError::Malformed)
}?);

Expand Down Expand Up @@ -730,7 +733,7 @@ impl ReplyMessage {
}
}
ReplyMessage::Success => {
content.element(REPLY_PDU_SUCCESS.into_unqualified())?;
content.element(SUCCESS.into_unqualified())?;
}
ReplyMessage::ErrorReply(errors) => {
for err in &errors.errors {
Expand Down Expand Up @@ -800,7 +803,7 @@ impl ListElement {
content: &mut encode::Content<W>
) -> Result<(), io::Error> {
content
.element(REPLY_PDU_LIST.into_unqualified())?
.element(LIST.into_unqualified())?
.attr("uri", &self.uri)?
.attr("hash", &self.hash)?;

Expand Down Expand Up @@ -836,7 +839,7 @@ impl ReportError {
content: &mut encode::Content<W>
) -> Result<(), io::Error> {
content
.element(REPLY_PDU_ERROR.into_unqualified())?
.element(REPORT_ERROR.into_unqualified())?
.attr("error_code", &self.error_code)?
.attr("tag", self.tag_for_xml())?
.content(|content| {
Expand Down

0 comments on commit 021bbb3

Please sign in to comment.