@@ -10,15 +10,13 @@ use crate::utils::units;
10
10
use crate :: { dist:: ToolchainDesc , toolchain:: ToolchainName , utils:: notify:: NotificationLevel } ;
11
11
12
12
#[ derive( Debug ) ]
13
- pub enum Notification < ' a > {
14
- Extracting ( & ' a Path , & ' a Path ) ,
13
+ pub ( crate ) enum Notification < ' a > {
15
14
ComponentAlreadyInstalled ( & ' a str ) ,
16
15
CantReadUpdateHash ( & ' a Path ) ,
17
16
NoUpdateHash ( & ' a Path ) ,
18
17
ChecksumValid ( & ' a str ) ,
19
18
FileAlreadyDownloaded ,
20
19
CachedFileChecksumFailed ,
21
- ExtensionNotInstalled ( & ' a str ) ,
22
20
MissingInstalledComponent ( & ' a str ) ,
23
21
/// The URL of the download is passed as the last argument, to allow us to track concurrent downloads.
24
22
DownloadingComponent ( & ' a str , & ' a TargetTriple , Option < & ' a TargetTriple > , & ' a str ) ,
@@ -30,11 +28,9 @@ pub enum Notification<'a> {
30
28
DownloadingLegacyManifest ,
31
29
SkippingNightlyMissingComponent ( & ' a ToolchainDesc , & ' a Manifest , & ' a [ Component ] ) ,
32
30
ForcingUnavailableComponent ( & ' a str ) ,
33
- ComponentUnavailable ( & ' a str , Option < & ' a TargetTriple > ) ,
34
31
StrayHash ( & ' a Path ) ,
35
- SignatureInvalid ( & ' a str ) ,
36
32
RetryingDownload ( & ' a str ) ,
37
- DownloadingFile ( & ' a Url , & ' a Path ) ,
33
+ DownloadingFile ( & ' a Url ) ,
38
34
/// Received the Content-Length of the to-be downloaded data with
39
35
/// the respective URL of the download (for tracking concurrent downloads).
40
36
DownloadContentLengthReceived ( u64 , Option < & ' a str > ) ,
@@ -50,6 +46,7 @@ pub enum Notification<'a> {
50
46
/// utils::notifications by the time tar unpacking is called.
51
47
SetDefaultBufferSize ( usize ) ,
52
48
Error ( String ) ,
49
+ #[ cfg( feature = "curl-backend" ) ]
53
50
UsingCurl ,
54
51
UsingReqwest ,
55
52
SetAutoInstall ( & ' a str ) ,
@@ -85,8 +82,7 @@ impl Notification<'_> {
85
82
| NoUpdateHash ( _)
86
83
| FileAlreadyDownloaded
87
84
| DownloadingLegacyManifest => NotificationLevel :: Debug ,
88
- Extracting ( _, _)
89
- | DownloadingComponent ( _, _, _, _)
85
+ DownloadingComponent ( _, _, _, _)
90
86
| InstallingComponent ( _, _, _)
91
87
| RemovingComponent ( _, _, _)
92
88
| RemovingOldComponent ( _, _, _)
@@ -96,22 +92,20 @@ impl Notification<'_> {
96
92
| RetryingDownload ( _)
97
93
| DownloadedManifest ( _, _) => NotificationLevel :: Info ,
98
94
CantReadUpdateHash ( _)
99
- | ExtensionNotInstalled ( _)
100
95
| MissingInstalledComponent ( _)
101
96
| CachedFileChecksumFailed
102
- | ComponentUnavailable ( _, _)
103
97
| ForcingUnavailableComponent ( _)
104
98
| StrayHash ( _) => NotificationLevel :: Warn ,
105
- SignatureInvalid ( _) => NotificationLevel :: Warn ,
106
99
SetDefaultBufferSize ( _) => NotificationLevel :: Trace ,
107
- DownloadingFile ( _, _ )
100
+ DownloadingFile ( _)
108
101
| DownloadContentLengthReceived ( _, _)
109
102
| DownloadDataReceived ( _, _)
110
103
| DownloadFinished ( _)
111
104
| DownloadFailed ( _)
112
105
| ResumingPartialDownload
113
- | UsingCurl
114
106
| UsingReqwest => NotificationLevel :: Debug ,
107
+ #[ cfg( feature = "curl-backend" ) ]
108
+ UsingCurl => NotificationLevel :: Debug ,
115
109
Error ( _) => NotificationLevel :: Error ,
116
110
ToolchainDirectory ( _)
117
111
| LookingForToolchain ( _)
@@ -139,18 +133,16 @@ impl Display for Notification<'_> {
139
133
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> std:: result:: Result < ( ) , fmt:: Error > {
140
134
use self :: Notification :: * ;
141
135
match self {
142
- Extracting ( _, _) => write ! ( f, "extracting..." ) ,
143
136
ComponentAlreadyInstalled ( c) => write ! ( f, "component {c} is up to date" ) ,
144
137
CantReadUpdateHash ( path) => write ! (
145
138
f,
146
139
"can't read update hash file: '{}', can't skip update..." ,
147
140
path. display( )
148
141
) ,
149
142
NoUpdateHash ( path) => write ! ( f, "no update hash at: '{}'" , path. display( ) ) ,
150
- ChecksumValid ( _ ) => write ! ( f, "checksum passed" ) ,
143
+ ChecksumValid ( url ) => write ! ( f, "checksum passed for {url} " ) ,
151
144
FileAlreadyDownloaded => write ! ( f, "reusing previously downloaded file" ) ,
152
145
CachedFileChecksumFailed => write ! ( f, "bad checksum for cached download" ) ,
153
- ExtensionNotInstalled ( c) => write ! ( f, "extension '{c}' was not installed" ) ,
154
146
MissingInstalledComponent ( c) => {
155
147
write ! ( f, "during uninstall component {c} was not found" )
156
148
}
@@ -195,13 +187,6 @@ impl Display for Notification<'_> {
195
187
write ! ( f, "latest update on {date}, no rust version" )
196
188
}
197
189
DownloadingLegacyManifest => write ! ( f, "manifest not found. trying legacy manifest" ) ,
198
- ComponentUnavailable ( pkg, toolchain) => {
199
- if let Some ( tc) = toolchain {
200
- write ! ( f, "component '{pkg}' is not available on target '{tc}'" )
201
- } else {
202
- write ! ( f, "component '{pkg}' is not available" )
203
- }
204
- }
205
190
StrayHash ( path) => write ! (
206
191
f,
207
192
"removing stray hash found at '{}' in order to continue" ,
@@ -226,20 +211,20 @@ impl Display for Notification<'_> {
226
211
ForcingUnavailableComponent ( component) => {
227
212
write ! ( f, "Force-skipping unavailable component '{component}'" )
228
213
}
229
- SignatureInvalid ( url) => write ! ( f, "Signature verification failed for '{url}'" ) ,
230
214
RetryingDownload ( url) => write ! ( f, "retrying download for '{url}'" ) ,
231
215
Error ( e) => write ! ( f, "error: '{e}'" ) ,
232
216
SetDefaultBufferSize ( size) => write ! (
233
217
f,
234
218
"using up to {} of RAM to unpack components" ,
235
219
units:: Size :: new( * size)
236
220
) ,
237
- DownloadingFile ( url, _ ) => write ! ( f, "downloading file from: '{url}'" ) ,
221
+ DownloadingFile ( url) => write ! ( f, "downloading file from: '{url}'" ) ,
238
222
DownloadContentLengthReceived ( len, _) => write ! ( f, "download size is: '{len}'" ) ,
239
223
DownloadDataReceived ( data, _) => write ! ( f, "received some data of size {}" , data. len( ) ) ,
240
224
DownloadFinished ( _) => write ! ( f, "download finished" ) ,
241
225
DownloadFailed ( _) => write ! ( f, "download failed" ) ,
242
226
ResumingPartialDownload => write ! ( f, "resuming partial download" ) ,
227
+ #[ cfg( feature = "curl-backend" ) ]
243
228
UsingCurl => write ! ( f, "downloading with curl" ) ,
244
229
UsingReqwest => write ! ( f, "downloading with reqwest" ) ,
245
230
SetAutoInstall ( auto) => write ! ( f, "auto install set to '{auto}'" ) ,
0 commit comments