@@ -8,7 +8,7 @@ use self::database::DatabaseBackend;
8
8
use self :: s3:: S3Backend ;
9
9
use crate :: error:: Result ;
10
10
use crate :: { db:: Pool , Config , Metrics } ;
11
- use anyhow:: ensure;
11
+ use anyhow:: { anyhow , ensure} ;
12
12
use chrono:: { DateTime , Utc } ;
13
13
use path_slash:: PathExt ;
14
14
use std:: {
@@ -145,7 +145,7 @@ impl Storage {
145
145
version : & str ,
146
146
path : & str ,
147
147
archive_storage : bool ,
148
- ) -> Result < Blob , Error > {
148
+ ) -> Result < Blob > {
149
149
Ok ( if archive_storage {
150
150
self . get_from_archive (
151
151
& rustdoc_archive_path ( name, version) ,
@@ -165,7 +165,7 @@ impl Storage {
165
165
version : & str ,
166
166
path : & str ,
167
167
archive_storage : bool ,
168
- ) -> Result < Blob , Error > {
168
+ ) -> Result < Blob > {
169
169
Ok ( if archive_storage {
170
170
self . get_from_archive (
171
171
& source_archive_path ( name, version) ,
@@ -184,7 +184,7 @@ impl Storage {
184
184
version : & str ,
185
185
path : & str ,
186
186
archive_storage : bool ,
187
- ) -> Result < bool , Error > {
187
+ ) -> Result < bool > {
188
188
Ok ( if archive_storage {
189
189
self . exists_in_archive ( & rustdoc_archive_path ( name, version) , path) ?
190
190
} else {
@@ -194,7 +194,7 @@ impl Storage {
194
194
} )
195
195
}
196
196
197
- pub ( crate ) fn exists_in_archive ( & self , archive_path : & str , path : & str ) -> Result < bool , Error > {
197
+ pub ( crate ) fn exists_in_archive ( & self , archive_path : & str , path : & str ) -> Result < bool > {
198
198
let index = self . get_index_for ( archive_path) ?;
199
199
Ok ( index. find_file ( path) . is_ok ( ) )
200
200
}
@@ -217,7 +217,7 @@ impl Storage {
217
217
max_size : usize ,
218
218
range : FileRange ,
219
219
compression : Option < CompressionAlgorithm > ,
220
- ) -> Result < Blob , Error > {
220
+ ) -> Result < Blob > {
221
221
let mut blob = match & self . backend {
222
222
StorageBackend :: Database ( db) => db. get ( path, max_size, Some ( range) ) ,
223
223
StorageBackend :: S3 ( s3) => s3. get ( path, max_size, Some ( range) ) ,
@@ -232,7 +232,7 @@ impl Storage {
232
232
Ok ( blob)
233
233
}
234
234
235
- fn get_index_for ( & self , archive_path : & str ) -> Result < archive_index:: Index , Error > {
235
+ fn get_index_for ( & self , archive_path : & str ) -> Result < archive_index:: Index > {
236
236
// remote/folder/and/x.zip.index
237
237
let remote_index_path = format ! ( "{}.index" , archive_path) ;
238
238
let local_index_path = self
@@ -249,7 +249,7 @@ impl Storage {
249
249
fs:: create_dir_all (
250
250
local_index_path
251
251
. parent ( )
252
- . ok_or_else ( || err_msg ( "index path without parent" ) ) ?,
252
+ . ok_or_else ( || anyhow ! ( "index path without parent" ) ) ?,
253
253
) ?;
254
254
let mut file = fs:: File :: create ( & local_index_path) ?;
255
255
file. write_all ( & index_content) ?;
@@ -263,7 +263,7 @@ impl Storage {
263
263
archive_path : & str ,
264
264
path : & str ,
265
265
max_size : usize ,
266
- ) -> Result < Blob , Error > {
266
+ ) -> Result < Blob > {
267
267
let index = self . get_index_for ( archive_path) ?;
268
268
let info = index. find_file ( path) ?;
269
269
@@ -288,7 +288,7 @@ impl Storage {
288
288
& self ,
289
289
archive_path : & str ,
290
290
root_dir : & Path ,
291
- ) -> Result < ( HashMap < PathBuf , String > , CompressionAlgorithm ) , Error > {
291
+ ) -> Result < ( HashMap < PathBuf , String > , CompressionAlgorithm ) > {
292
292
let mut file_paths = HashMap :: new ( ) ;
293
293
294
294
// We are only using the `zip` library to create the archives and the matching
0 commit comments