Skip to content

Commit 75f7a1c

Browse files
committed
use struct literal to create struct
1 parent c173e27 commit 75f7a1c

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

src/storage/archive_index.rs

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,6 @@ pub(crate) fn find_in_slice(bytes: &[u8], search_for: &str) -> Result<Option<Fil
6666
search_for: String,
6767
}
6868

69-
impl FindFileListVisitor {
70-
pub fn new(path: String) -> Self {
71-
FindFileListVisitor { search_for: path }
72-
}
73-
}
74-
7569
impl<'de> Visitor<'de> for FindFileListVisitor {
7670
type Value = Option<FileInfo>;
7771

@@ -91,12 +85,6 @@ pub(crate) fn find_in_slice(bytes: &[u8], search_for: &str) -> Result<Option<Fil
9185
search_for: String,
9286
}
9387

94-
impl FindFileVisitor {
95-
pub fn new(search_for: String) -> Self {
96-
FindFileVisitor { search_for }
97-
}
98-
}
99-
10088
impl<'de> DeserializeSeed<'de> for FindFileVisitor {
10189
type Value = Option<FileInfo>;
10290
fn deserialize<D>(self, deserializer: D) -> Result<Self::Value, D::Error>
@@ -140,7 +128,9 @@ pub(crate) fn find_in_slice(bytes: &[u8], search_for: &str) -> Result<Option<Fil
140128

141129
while let Some(key) = map.next_key::<&str>()? {
142130
if key == "files" {
143-
return map.next_value_seed(FindFileVisitor::new(self.search_for));
131+
return map.next_value_seed(FindFileVisitor {
132+
search_for: self.search_for,
133+
});
144134
}
145135
}
146136

@@ -159,7 +149,10 @@ pub(crate) fn find_in_slice(bytes: &[u8], search_for: &str) -> Result<Option<Fil
159149
}
160150
}
161151

162-
Ok(FindFileListVisitor::new(search_for.to_string()).deserialize(&mut deserializer)?)
152+
Ok(FindFileListVisitor {
153+
search_for: search_for.to_string(),
154+
}
155+
.deserialize(&mut deserializer)?)
163156
}
164157

165158
pub(crate) fn find_in_file<P: AsRef<Path>>(

0 commit comments

Comments
 (0)