@@ -5,23 +5,23 @@ use crate::utils::{Dependency, MetadataPackage, Target};
5
5
use failure:: Error ;
6
6
7
7
#[ must_use = "FakeRelease does nothing until you call .create()" ]
8
- pub ( crate ) struct FakeRelease < ' db > {
9
- db : & ' db TestDatabase ,
8
+ pub ( crate ) struct FakeRelease < ' a > {
9
+ db : & ' a TestDatabase ,
10
10
package : MetadataPackage ,
11
11
build_result : BuildResult ,
12
12
/// name, content
13
- source_files : Vec < ( String , Vec < u8 > ) > ,
13
+ source_files : Vec < ( & ' a str , & ' a [ u8 ] ) > ,
14
14
/// name, content
15
- rustdoc_files : Vec < ( String , Vec < u8 > ) > ,
15
+ rustdoc_files : Vec < ( & ' a str , & ' a [ u8 ] ) > ,
16
16
doc_targets : Vec < String > ,
17
17
default_target : Option < String > ,
18
18
cratesio_data : CratesIoData ,
19
19
has_docs : bool ,
20
20
has_examples : bool ,
21
21
}
22
22
23
- impl < ' db > FakeRelease < ' db > {
24
- pub ( super ) fn new ( db : & ' db TestDatabase ) -> Self {
23
+ impl < ' a > FakeRelease < ' a > {
24
+ pub ( super ) fn new ( db : & ' a TestDatabase ) -> Self {
25
25
FakeRelease {
26
26
db,
27
27
package : MetadataPackage {
@@ -85,28 +85,15 @@ impl<'db> FakeRelease<'db> {
85
85
self
86
86
}
87
87
88
- pub ( crate ) fn file < M , P , D > ( mut self , mimetype : M , path : P , data : D ) -> Self
89
- where M : Into < String > ,
90
- P : Into < String > ,
91
- D : Into < Vec < u8 > > ,
92
- {
93
- let ( mimetype, path, data) = ( mimetype. into ( ) , path. into ( ) , data. into ( ) ) ;
94
- self . files . push ( ( mimetype, path, data) ) ;
95
- self
96
- }
97
-
98
- pub ( crate ) fn rustdoc_file < P , D > ( mut self , path : P , data : D ) -> Self
99
- where P : Into < String > ,
100
- D : Into < Vec < u8 > > ,
101
- {
102
- self . rustdoc_files . push ( ( path. into ( ) , data. into ( ) ) ) ;
88
+ pub ( crate ) fn rustdoc_file ( mut self , path : & ' a str , data : & ' a [ u8 ] ) -> Self {
89
+ self . rustdoc_files . push ( ( path, data) ) ;
103
90
self
104
91
}
105
92
106
93
pub ( crate ) fn create ( self ) -> Result < i32 , Error > {
107
94
let tempdir = tempdir:: TempDir :: new ( "docs.rs-fake" ) ?;
108
95
109
- let upload_files = |prefix : & str , files : & [ ( String , Vec < u8 > ) ] | {
96
+ let upload_files = |prefix : & str , files : & [ ( & str , & [ u8 ] ) ] | {
110
97
let path_prefix = tempdir. path ( ) . join ( prefix) ;
111
98
std:: fs:: create_dir ( & path_prefix) ?;
112
99
0 commit comments