Skip to content

Commit

Permalink
Fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
sftse committed Jun 11, 2023
1 parent b0c47be commit c1b9336
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions src/internal/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,37 +123,37 @@ mod tests {
#[test]
fn absolute_path_is_valid() {
assert_eq!(
name_chain_from_path(&Path::new("/foo/bar/baz/")).unwrap(),
name_chain_from_path(Path::new("/foo/bar/baz/")).unwrap(),
vec!["foo", "bar", "baz"]
);
}

#[test]
fn relative_path_is_valid() {
assert_eq!(
name_chain_from_path(&Path::new("foo/bar/baz")).unwrap(),
name_chain_from_path(Path::new("foo/bar/baz")).unwrap(),
vec!["foo", "bar", "baz"]
);
}

#[test]
fn path_with_parents_is_valid() {
assert_eq!(
name_chain_from_path(&Path::new("foo/bar/../baz")).unwrap(),
name_chain_from_path(Path::new("foo/bar/../baz")).unwrap(),
vec!["foo", "baz"]
);
}

#[test]
#[should_panic(expected = "Invalid path (must be within root)")]
fn parent_of_root_is_invalid() {
name_chain_from_path(&Path::new("foo/../../baz")).unwrap();
name_chain_from_path(Path::new("foo/../../baz")).unwrap();
}

#[test]
fn canonical_path_is_absolute() {
let path = Path::new("foo/bar/../baz");
let names = name_chain_from_path(&path).unwrap();
let names = name_chain_from_path(path).unwrap();
assert_eq!(path_from_name_chain(&names), PathBuf::from("/foo/baz"));
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/internal/stream.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::internal::{consts, MiniAllocator, ObjType, SectorInit, Timestamp};
use crate::internal::{consts, MiniAllocator, ObjType, SectorInit};
use std::cell::RefCell;
use std::io::{self, BufRead, Read, Seek, SeekFrom, Write};
use std::rc::{Rc, Weak};
Expand Down
8 changes: 4 additions & 4 deletions tests/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ fn truncate_stream() {
assert_eq!(stream.seek(SeekFrom::Start(6000)).unwrap(), 6000);
stream.set_len(7000).unwrap();
assert_eq!(stream.len(), 7000);
assert_eq!(stream.seek(SeekFrom::Current(0)).unwrap(), 6000);
assert_eq!(stream.stream_position().unwrap(), 6000);
stream.set_len(5000).unwrap();
assert_eq!(stream.len(), 5000);
stream.write_all(&vec![b'x'; 1000]).unwrap();
Expand Down Expand Up @@ -672,13 +672,13 @@ fn extend_stream() {
assert_eq!(stream.seek(SeekFrom::Start(1000)).unwrap(), 1000);
stream.write_all(&vec![b'y'; 500]).unwrap();
assert_eq!(stream.len(), 2000);
assert_eq!(stream.seek(SeekFrom::Current(0)).unwrap(), 1500);
assert_eq!(stream.stream_position().unwrap(), 1500);
stream.set_len(5000).unwrap();
assert_eq!(stream.len(), 5000);
assert_eq!(stream.seek(SeekFrom::Current(0)).unwrap(), 1500);
assert_eq!(stream.stream_position().unwrap(), 1500);
stream.write_all(&vec![b'z'; 500]).unwrap();
assert_eq!(stream.len(), 5000);
assert_eq!(stream.seek(SeekFrom::Current(0)).unwrap(), 2000);
assert_eq!(stream.stream_position().unwrap(), 2000);
}

let cursor = comp.into_inner();
Expand Down
2 changes: 1 addition & 1 deletion tests/malformed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ where

// Checks to see if a file can be walked over and read properly, or fail if it can not be read
fn can_read(path: &Path) {
let data = std::fs::read(&path).unwrap();
let data = std::fs::read(path).unwrap();

let cursor = Cursor::new(data);
let mut cfb = match CompoundFile::open(cursor) {
Expand Down

0 comments on commit c1b9336

Please sign in to comment.