Skip to content

Commit

Permalink
Allow some stricter Clippy lints for now
Browse files Browse the repository at this point in the history
  • Loading branch information
sgoll committed Sep 4, 2024
1 parent 3ceea40 commit 4f97b32
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
25 changes: 17 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ unused = { level = "warn", priority = -1 }
warnings = "warn"

[lints.clippy]
absolute_paths = "warn"
# We use absolute paths where we require some item only once. Most often, these
# share a name with another item in scope and we don't want to import an alias.
absolute_paths = "allow"
allow_attributes = "warn"
allow_attributes_without_reason = "warn"
as_conversions = "warn"
Expand All @@ -81,7 +83,8 @@ clone_on_ref_ptr = "warn"
default_trait_access = "warn"
enum_variant_names = "warn"
error_impl_error = "warn"
expect_used = "warn"
# We panic in certain less likely situations. In each case, this is documented.
expect_used = "allow"
fallible_impl_from = "warn"
format_push_string = "warn"
get_unwrap = "warn"
Expand All @@ -90,21 +93,27 @@ indexing_slicing = "warn"
manual_assert = "warn"
match_on_vec_items = "warn"
match_wild_err_arm = "warn"
missing_assert_message = "warn"
# TODO: Add assert messages.
missing_assert_message = "allow"
missing_const_for_fn = "warn"
missing_errors_doc = "warn"
mod_module_files = "warn"
module_name_repetitions = "warn"
panic = "warn"
# We export most types from the top module, allow prefixes to distinguish them.
module_name_repetitions = "allow"
# We panic in certain less likely situations. In each case, this is documented.
panic = "allow"
panic_in_result_fn = "warn"
pedantic = { level = "warn", priority = -1 }
should_panic_without_expect = "warn"
string_slice = "warn"
unimplemented = "warn"
unnecessary_self_imports = "warn"
unreachable = "warn"
unwrap_in_result = "warn"
unwrap_used = "warn"
# We panic in certain less likely situations. In each case, this is documented.
unreachable = "allow"
# We panic in certain less likely situations. In each case, this is documented.
unwrap_in_result = "allow"
# TODO: Use `expect()` instead.
unwrap_used = "allow"
verbose_file_reads = "warn"

[[example]]
Expand Down
1 change: 1 addition & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pub type Result<T> = std::result::Result<T, Error>;
///
/// [`is_good()`]: crate::ua::StatusCode::is_good
#[derive(Debug, Error)]
#[allow(clippy::error_impl_error)] // The main error type of our crate may be named `Error`.
pub enum Error {
/// Error from server.
#[error("{0}")]
Expand Down
2 changes: 2 additions & 0 deletions src/ua/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -446,12 +446,14 @@ impl<T: DataType> fmt::Debug for Array<T> {
impl<T: DataType> ops::Index<usize> for Array<T> {
type Output = T;

#[allow(clippy::indexing_slicing)] // We forward the underlying panic.
fn index(&self, index: usize) -> &Self::Output {
&self.as_slice()[index]
}
}

impl<T: DataType> ops::IndexMut<usize> for Array<T> {
#[allow(clippy::indexing_slicing)] // We forward the underlying panic.
fn index_mut(&mut self, index: usize) -> &mut Self::Output {
&mut self.as_slice_mut()[index]
}
Expand Down

0 comments on commit 4f97b32

Please sign in to comment.