File tree Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -102,15 +102,26 @@ pub struct RemoteRelease {
102
102
103
103
impl RemoteRelease {
104
104
/// The release's download URL for the given target.
105
- pub fn download_url ( & self , fallback_target : & str , installer : Option < Installer > ) -> Result < & Url > {
106
- let target = installer. map ( |installer| format ! ( "{fallback_target}-{}" , installer. suffix( ) ) ) . unwrap_or ( "" . to_string ( ) ) ;
105
+ pub fn download_url (
106
+ & self ,
107
+ fallback_target : & str ,
108
+ installer : Option < Installer > ,
109
+ ) -> Result < & Url > {
110
+ let target = installer
111
+ . map ( |installer| format ! ( "{fallback_target}-{}" , installer. suffix( ) ) )
112
+ . unwrap_or ( "" . to_string ( ) ) ;
107
113
match self . data {
108
114
RemoteReleaseInner :: Dynamic ( ref platform) => Ok ( & platform. url ) ,
109
115
RemoteReleaseInner :: Static { ref platforms } => platforms. get ( & target) . map_or_else (
110
- || platforms. get ( fallback_target) . map_or (
111
- Err ( Error :: TargetsNotFound ( target. to_string ( ) , fallback_target. to_string ( ) ) ) ,
116
+ || {
117
+ platforms. get ( fallback_target) . map_or (
118
+ Err ( Error :: TargetsNotFound (
119
+ target. to_string ( ) ,
120
+ fallback_target. to_string ( ) ,
121
+ ) ) ,
112
122
|p| Ok ( & p. url ) ,
113
- ) ,
123
+ )
124
+ } ,
114
125
|p| Ok ( & p. url ) ,
115
126
) ,
116
127
}
You can’t perform that action at this time.
0 commit comments