File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -102,18 +102,15 @@ 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 , target : & str , installer : Option < Installer > ) -> Result < & Url > {
106
- let fallback_target = installer. map ( |installer| format ! ( "{target }-{}" , installer. suffix( ) ) ) ;
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 ( ) ) ;
107
107
match self . data {
108
108
RemoteReleaseInner :: Dynamic ( ref platform) => Ok ( & platform. url ) ,
109
- RemoteReleaseInner :: Static { ref platforms } => platforms. get ( target) . map_or_else (
110
- || match fallback_target {
111
- Some ( fallback) => platforms. get ( & fallback) . map_or (
112
- Err ( Error :: TargetsNotFound ( target. to_string ( ) , fallback) ) ,
109
+ 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 ( ) ) ) ,
113
112
|p| Ok ( & p. url ) ,
114
113
) ,
115
- None => Err ( Error :: TargetNotFound ( target. to_string ( ) ) ) ,
116
- } ,
117
114
|p| Ok ( & p. url ) ,
118
115
) ,
119
116
}
You can’t perform that action at this time.
0 commit comments