Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixing all open clippy warnings #72

Merged
merged 1 commit into from
Nov 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion clippy.toml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
doc-valid-idents = ["AutoCAD", "PostScript", ".."]
doc-valid-idents = ["AutoCAD", "PostScript", "..", "DesignCenter", "PlotStyle", "DWFx"]
2 changes: 1 addition & 1 deletion src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub struct Block {
pub entities: Vec<Entity>,
/// Extension data groups.
pub extension_data_groups: Vec<ExtensionGroup>,
/// XData.
/// `XData`.
pub x_data: Vec<XData>,
}

Expand Down
2 changes: 1 addition & 1 deletion src/dxb_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ impl<T: Read> DxbReader<T> {
fn wrap_common_values(&self, specific: EntityType) -> Entity {
let mut entity = Entity::new(specific);
entity.common.color = self.current_color.clone();
entity.common.layer = self.layer_name.clone();
entity.common.layer.clone_from(&self.layer_name);
entity
}
fn read_null_terminated_string(&mut self) -> DxfResult<String> {
Expand Down
4 changes: 2 additions & 2 deletions src/entity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1743,7 +1743,7 @@ mod tests {
common: Default::default(),
specific: EntityType::Line(Default::default()),
};
ent.common.layer = "some-layer".to_owned();
"some-layer".clone_into(&mut ent.common.layer);
drawing.add_entity(ent);
assert_contains_pairs(
&drawing,
Expand All @@ -1764,7 +1764,7 @@ mod tests {
common: Default::default(),
specific: EntityType::Line(Default::default()),
};
ent.common.layer = "some-layer".to_owned();
"some-layer".clone_into(&mut ent.common.layer);
drawing.add_entity(ent);
assert_contains_pairs(
&drawing,
Expand Down
4 changes: 2 additions & 2 deletions src/helper_functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ pub mod tests {
assert!(actual.contains(&contents));
}

fn try_find_index<T>(superset: &Vec<T>, subset: &Vec<T>) -> Option<usize>
fn try_find_index<T>(superset: &[T], subset: &[T]) -> Option<usize>
where
T: PartialEq,
{
Expand All @@ -634,7 +634,7 @@ pub mod tests {
None
}

pub fn assert_vec_contains<T>(actual: &Vec<T>, expected: &Vec<T>)
pub fn assert_vec_contains<T>(actual: &[T], expected: &[T])
where
T: PartialEq,
{
Expand Down
2 changes: 1 addition & 1 deletion src/misc_tests/encoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ fn round_trip_thumbnail(thumbnail: image::DynamicImage) -> image::DynamicImage {
let drawing_pairs = drawing.code_pairs().unwrap();
assert_vec_contains(
&drawing_pairs,
&vec![
&[
CodePair::new_str(0, "SECTION"),
CodePair::new_str(2, "THUMBNAILIMAGE"),
],
Expand Down
4 changes: 2 additions & 2 deletions src/thumbnail.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ fn read_thumbnail_bytes_from_code_pairs(iter: &mut CodePairPutBack) -> DxfResult
Ok(Some(data))
}

fn update_thumbnail_data_offset_in_situ(data: &mut Vec<u8>) -> DxfResult<bool> {
fn update_thumbnail_data_offset_in_situ(data: &mut [u8]) -> DxfResult<bool> {
// calculate the image data offset
let dib_header_size = read_i32(data, FILE_HEADER_LENGTH)? as usize;

Expand Down Expand Up @@ -240,7 +240,7 @@ fn test_get_u32() {
assert_eq!(0x12345678, value);
}

fn set_i32(data: &mut Vec<u8>, offset: usize, value: i32) -> DxfResult<()> {
fn set_i32(data: &mut [u8], offset: usize, value: i32) -> DxfResult<()> {
let expected_length = offset + 4;
if data.len() < expected_length {
return Err(DxfError::UnexpectedEndOfInput);
Expand Down
Loading