Skip to content

Commit

Permalink
Clippy taken care of
Browse files Browse the repository at this point in the history
  • Loading branch information
kotauskas committed Mar 12, 2021
1 parent b179227 commit f6313b9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 60 deletions.
67 changes: 7 additions & 60 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#![warn(
rust_2018_idioms,
clippy::cargo,
clippy::pedantic,
clippy::nursery,
missing_copy_implementations,
missing_debug_implementations,
Expand All @@ -52,69 +53,15 @@
//missing_doc_code_examples,
unused_qualifications,
variant_size_differences,
clippy::cast_lossless,
clippy::await_holding_lock,
clippy::checked_conversions,
clippy::copy_iterator,
clippy::expl_impl_clone_on_copy,
clippy::explicit_iter_loop,
clippy::explicit_into_iter_loop,
clippy::filter_map,
clippy::filter_map_next,
clippy::find_map,
clippy::map_flatten,
clippy::map_unwrap_or,
clippy::fn_params_excessive_bools,
clippy::implicit_hasher,
clippy::implicit_saturating_sub,
clippy::inefficient_to_string,
clippy::invalid_upcast_comparisons,
clippy::items_after_statements,
clippy::large_stack_arrays,
clippy::let_unit_value,
clippy::macro_use_imports,
clippy::match_same_arms,
clippy::match_wild_err_arm,
clippy::match_wildcard_for_single_variants,
// sick of this stupid lint, disabling
// clippy::module_name_repetitions,
clippy::mut_mut,
clippy::needless_continue,
clippy::needless_pass_by_value,
clippy::option_if_let_else,
clippy::option_option,
clippy::pub_enum_variant_names,
clippy::range_plus_one,
clippy::range_minus_one,
clippy::redundant_closure_for_method_calls,
clippy::same_functions_in_if_condition,
// also sick of this one, gives too much false positives inherent to its design
// clippy::shadow_unrelated,
clippy::similar_names,
clippy::single_match_else,
clippy::string_add_assign,
clippy::too_many_lines,
clippy::type_repetition_in_bounds,
clippy::trivially_copy_pass_by_ref,
clippy::unicode_not_nfc,
clippy::unnested_or_patterns,
clippy::unsafe_derive_deserialize,
clippy::unused_self,
clippy::used_underscore_binding,
clippy::clone_on_ref_ptr,
clippy::dbg_macro,
clippy::decimal_literal_representation,
clippy::filetype_is_file,
clippy::get_unwrap,
clippy::rest_pat_in_fully_bound_structs,
clippy::unneeded_field_pattern,
clippy::unwrap_used, // Only .expect() allowed
clippy::use_debug,
clippy::verbose_file_reads,
clippy::wrong_pub_self_convention,
)]
#![deny(anonymous_parameters, bare_trait_objects)]
#![allow(clippy::use_self)] // FIXME reenable when it gets fixed
#![allow(
clippy::use_self, // FIXME reenable when it gets fixed
clippy::clippy::wildcard_imports, // Worst lint ever
clippy::clippy::module_name_repetitions, // Annoying and stupid
clippy::shadow_unrelated, // Countless false positives, very annoying
)]
#![cfg_attr(not(feature = "std"), no_std)]
// TODO reimplement LinkedList
//#![cfg_attr(feature = "linked_list_storage", feature(linked_list_cursors))]
Expand Down
4 changes: 4 additions & 0 deletions src/octree/impl_traversable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ where
.ok_or(error)
}
VisitorDirection::Child(num) => {
// False positive, we have a check here
#[allow(clippy::clippy::cast_possible_truncation)]
let num = if num <= 7 {
num as u8
} else {
Expand Down Expand Up @@ -100,6 +102,8 @@ where
}
#[track_caller]
fn nth_child_of(&self, cursor: &Self::Cursor, child_num: usize) -> Option<Self::Cursor> {
// False positive, we have a check here
#[allow(clippy::clippy::cast_possible_truncation)]
if child_num < 8 {
let node_ref = NodeRef::new_raw(self, cursor.clone())
.unwrap_or_else(|| panic!("invalid cursor: {:?}", cursor));
Expand Down
4 changes: 4 additions & 0 deletions src/quadtree/impl_traversable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ where
.ok_or(error)
}
VisitorDirection::Child(num) => {
// False positive, we have a check here
#[allow(clippy::clippy::cast_possible_truncation)]
let num = if num <= 3 {
num as u8
} else {
Expand Down Expand Up @@ -100,6 +102,8 @@ where
}
#[track_caller]
fn nth_child_of(&self, cursor: &Self::Cursor, child_num: usize) -> Option<Self::Cursor> {
// False positive, we have a check here
#[allow(clippy::clippy::cast_possible_truncation)]
if child_num < 4 {
let node_ref = NodeRef::new_raw(self, cursor.clone())
.unwrap_or_else(|| panic!("invalid cursor: {:?}", cursor));
Expand Down
1 change: 1 addition & 0 deletions src/traversal/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ pub trait Traversable: Sized {
///
/// # Panics
/// Required to panic if the current cursor value is invalid, i.e. it's impossible to determine the previously valid cursor value (as opposed to merely invalid directions but valid cursor, which can be recovered from).
#[allow(clippy::missing_errors_doc)]
fn advance_cursor<V>(
&self,
cursor: Self::Cursor,
Expand Down

0 comments on commit f6313b9

Please sign in to comment.