even stricter lints, first fixes

This commit is contained in:
Vinzenz Schroeter 2025-03-25 19:18:21 +01:00
parent 2c3d31f649
commit 3384cc4ee9
10 changed files with 21 additions and 13 deletions

View file

@ -65,11 +65,19 @@ refining_impl_trait_reachable = "warn"
rust-2024-compatibility = "warn"
[lints.clippy]
complexity = {level = "warn", priority = -1 }
perf = {level = "warn", priority = -1 }
style = {level = "warn", priority = -1 }
pedantic = {level = "warn", priority = -1 }
unwrap_used = "warn"
expect_used = "warn"
panic = "warn"
incompatible_msrv = "forbid"
# too many false positives as often the module only contains the one struct
module_name_repetitions = "allow"
[lints.rustdoc]
private_doc_tests = "warn"
unescaped_backticks = "warn"

View file

@ -51,9 +51,10 @@ impl Brightness {
/// lowest possible brightness value, 0
pub const MIN: Brightness = Brightness(0);
/// Create a brightness value without returning an error for brightnesses above [Brightness::MAX].
/// Create a brightness value without returning an error for brightnesses above [`Brightness::MAX`].
///
/// returns: the specified value as a [Brightness], or [Brightness::MAX].
/// returns: the specified value as a [Brightness], or [`Brightness::MAX`].
#[must_use]
pub fn saturating_from(value: u8) -> Brightness {
if value > Brightness::MAX.into() {
Brightness::MAX

View file

@ -84,7 +84,7 @@ impl TryFrom<Packet> for BitmapCommand {
fn try_from(packet: Packet) -> Result<Self, Self::Error> {
let code = CommandCode::try_from(packet.header.command_code).map_err(
|_| TryFromPacketError::InvalidCommand(packet.header.command_code),
|()| TryFromPacketError::InvalidCommand(packet.header.command_code),
)?;
match code {

View file

@ -56,7 +56,7 @@ mod tests {
use super::*;
use crate::{
commands::tests::{round_trip, TestImplementsCommand},
Header
Header,
};
impl TestImplementsCommand for BitmapLegacyCommand {}

View file

@ -4,7 +4,7 @@ use crate::{
CompressionCode, Header, Offset, Packet, TryIntoPacketError, TypedCommand,
};
/// Binary operations for use with the [BitVecCommand] command.
/// Binary operations for use with the [`BitVecCommand`] command.
#[derive(Clone, PartialEq, Eq, Debug, Default)]
pub enum BinaryOperation {
/// r := a
@ -23,7 +23,7 @@ pub enum BinaryOperation {
/// The screen will continuously overwrite more pixel data without regarding the offset, meaning
/// once the starting row is full, overwriting will continue on column 0.
///
/// The [BinaryOperation] will be applied on the display comparing old and sent bit.
/// The [`BinaryOperation`] will be applied on the display comparing old and sent bit.
///
/// `new_bit = old_bit op sent_bit`
///

View file

@ -36,8 +36,8 @@ impl Connection for WebsocketConnection {
let data: Vec<u8> = packet
.try_into()
.map(Into::<Vec<u8>>::into)
.map_err(SendError::IntoPacket)?
.into();
.map_err(SendError::IntoPacket)?;
#[allow(clippy::unwrap)]
let mut socket = self.0.lock().unwrap();
socket
.send(tungstenite::Message::Binary(data.into()))

View file

@ -316,7 +316,7 @@ pub enum TryLoadValueGridError {
}
impl<T: Value> Grid<T> for ValueGrid<T> {
/// Sets the value of the cell at the specified position in the `ValueGrid.
/// Sets the value of the cell at the specified position in the grid.
///
/// # Arguments
///
@ -379,7 +379,7 @@ impl<T: Value> From<ValueGrid<T>> for Vec<T> {
}
}
/// An iterator iver the rows in a [ValueGrid]
/// An iterator iver the rows in a [`ValueGrid`]
#[must_use]
pub struct IterGridRows<'t, T: Value> {
grid: &'t ValueGrid<T>,

View file

@ -2,8 +2,6 @@
//!
//! See <https://en.wikipedia.org/wiki/Code_page_437#Character_set>
#![allow(clippy::module_name_repetitions)] // CP437 is the name of the encoding and thus repeated
use crate::{CharGrid, Cp437Grid};
use std::collections::HashMap;

View file

@ -20,6 +20,7 @@ impl<Unit: DisplayUnit> Origin<Unit> {
};
/// Create a new [Origin] instance for the provided position.
#[must_use]
pub fn new(x: usize, y: usize) -> Self {
Self {
x,

View file

@ -55,7 +55,7 @@ pub type Payload = Vec<u8>;
///
/// Contents should probably only be used directly to use features not exposed by the library.
///
/// You may want to use [crate::Command] or [crate::TypedCommand] instead.
/// You may want to use [`crate::Command`] or [`crate::TypedCommand`] instead.
#[derive(Clone, Debug, PartialEq)]
pub struct Packet {
/// Meta-information for the packed command