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 image: rustlang/rust:nightly-alpine
commands: commands:
- cargo fmt --check - cargo fmt --check
- cargo clippy -- -Dwarnings
test: test:
image: rustlang/rust:nightly-alpine image: rustlang/rust:nightly-alpine
commands: commands:

View file

@ -52,17 +52,17 @@ impl StdError for Error {}
impl fmt::Display for Error { impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self { match self {
Error::MismatchJids(jid1, jid2) => write!(f, "Mismatch Jids: {}, {}", jid1, jid2), Error::MismatchJids(jid1, jid2) => write!(f, "Mismatch Jids: {jid1}, {jid2}"),
Error::NickAlreadyAssigned(err) => write!(f, "Nickname already assigned: {}", err), Error::NickAlreadyAssigned(err) => write!(f, "Nickname already assigned: {err}"),
Error::NonexistantSession(err) => write!(f, "Session doesn't exist: {:?}", err), Error::NonexistantSession(err) => write!(f, "Session doesn't exist: {err:?}"),
Error::SessionAlreadyExists(err) => write!(f, "Session already exist: {:?}", err), Error::SessionAlreadyExists(err) => write!(f, "Session already exist: {err:?}"),
Error::ParticipantNotFound(err) => write!(f, "Participant not found: {}", err), Error::ParticipantNotFound(err) => write!(f, "Participant not found: {err}"),
Error::InvalidOriginJid => write!(f, "Invalid origin JID"), Error::InvalidOriginJid => write!(f, "Invalid origin JID"),
Error::InvalidDestinationJid => write!(f, "Invalid destination JID"), Error::InvalidDestinationJid => write!(f, "Invalid destination JID"),
Error::UnhandledIq(err) => write!(f, "Unhandled Iq: {:?}", err), Error::UnhandledIq(err) => write!(f, "Unhandled Iq: {err:?}"),
Error::Jid(err) => write!(f, "Jid Parse error: {}", err), Error::Jid(err) => write!(f, "Jid Parse error: {err}"),
Error::Xmpp(err) => write!(f, "XMPP error: {}", err), Error::Xmpp(err) => write!(f, "XMPP error: {err}"),
Error::Parser(err) => write!(f, "Parser 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, ErrorType::Cancel,
DefinedCondition::Conflict, DefinedCondition::Conflict,
"en", "en",
format!("Nickname conflict: {}", nick), format!("Nickname conflict: {nick}"),
) )
.into()]); .into()]);
component.send_stanza(error).await?; component.send_stanza(error).await?;

View file

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

View file

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