CI: fail on clippy warnings

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2022-12-27 09:14:03 +01:00
parent c9be530c56
commit c50e3adec6
Signed by: pep
GPG key ID: DEDA74AEECA9D0F2
5 changed files with 15 additions and 14 deletions

View file

@ -5,6 +5,7 @@ pipeline:
image: rustlang/rust:nightly-alpine
commands:
- cargo fmt --check
- cargo clippy -- -Dwarnings
test:
image: rustlang/rust:nightly-alpine
commands:

View file

@ -52,17 +52,17 @@ impl StdError for Error {}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Error::MismatchJids(jid1, jid2) => write!(f, "Mismatch Jids: {}, {}", jid1, jid2),
Error::NickAlreadyAssigned(err) => write!(f, "Nickname already assigned: {}", err),
Error::NonexistantSession(err) => write!(f, "Session doesn't exist: {:?}", err),
Error::SessionAlreadyExists(err) => write!(f, "Session already exist: {:?}", err),
Error::ParticipantNotFound(err) => write!(f, "Participant not found: {}", err),
Error::MismatchJids(jid1, jid2) => write!(f, "Mismatch Jids: {jid1}, {jid2}"),
Error::NickAlreadyAssigned(err) => write!(f, "Nickname already assigned: {err}"),
Error::NonexistantSession(err) => write!(f, "Session doesn't exist: {err:?}"),
Error::SessionAlreadyExists(err) => write!(f, "Session already exist: {err:?}"),
Error::ParticipantNotFound(err) => write!(f, "Participant not found: {err}"),
Error::InvalidOriginJid => write!(f, "Invalid origin JID"),
Error::InvalidDestinationJid => write!(f, "Invalid destination JID"),
Error::UnhandledIq(err) => write!(f, "Unhandled Iq: {:?}", err),
Error::Jid(err) => write!(f, "Jid Parse error: {}", err),
Error::Xmpp(err) => write!(f, "XMPP error: {}", err),
Error::Parser(err) => write!(f, "Parser error: {}", err),
Error::UnhandledIq(err) => write!(f, "Unhandled Iq: {err:?}"),
Error::Jid(err) => write!(f, "Jid Parse error: {err}"),
Error::Xmpp(err) => write!(f, "XMPP error: {err}"),
Error::Parser(err) => write!(f, "Parser error: {err}"),
}
}
}

View file

@ -94,7 +94,7 @@ async fn handle_presence_full_available<C: ComponentTrait>(
ErrorType::Cancel,
DefinedCondition::Conflict,
"en",
format!("Nickname conflict: {}", nick),
format!("Nickname conflict: {nick}"),
)
.into()]);
component.send_stanza(error).await?;

View file

@ -39,7 +39,7 @@ impl Occupant {
Ok(Occupant {
real: BareJid::from(session.real().clone()),
nick: participant.resource.clone(),
participant: participant,
participant,
sessions: vec![session],
})
}

View file

@ -286,7 +286,7 @@ impl Room {
Some(BroadcastPresence::Resync) => {
self.broadcast_presence(
component,
&occupant,
occupant,
new_session.presence,
BroadcastPresence::Resync,
)
@ -297,7 +297,7 @@ impl Room {
self.broadcast_presence(
component,
&occupant,
occupant,
new_session.presence.clone(),
BroadcastPresence::Join,
)
@ -327,7 +327,7 @@ impl Room {
let occupant = self.get_occupant(&session)?;
self.broadcast_presence(
component,
&occupant,
occupant,
session.presence,
BroadcastPresence::Update,
)