File tree Expand file tree Collapse file tree 3 files changed +6
-1
lines changed
Expand file tree Collapse file tree 3 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -115,9 +115,11 @@ impl Archive for Tarball {
115115/// more efficient than simply downloading the entire file up front.
116116fn fetch_isize ( url : & str , len : u64 ) -> Result < [ u8 ; 4 ] , ArchiveError > {
117117 let mut header_values = Vec :: with_capacity ( 1 ) ;
118- Range :: bytes ( len - 4 ..= len - 1 )
118+ Range :: bytes ( len - 4 ..len)
119119 . unwrap ( )
120120 . encode ( & mut header_values) ;
121+ // We just pushed a header in with the `.encode` above, so there will always
122+ // be a value at `.first()`.
121123 let range_header = header_values. first ( ) . unwrap ( ) ;
122124
123125 let ( status, headers, mut response) = attohttpc:: get ( url)
Original file line number Diff line number Diff line change @@ -258,6 +258,7 @@ fn resolve_node_versions(url: &str) -> Fallible<RawNodeIndex> {
258258
259259 let mut header_values = Vec :: with_capacity ( 1 ) ;
260260 expires. encode ( & mut header_values) ;
261+ // Since we just `.encode()`d into `header_values
261262 let encoded_expires = header_values. first ( ) . unwrap ( ) . to_str ( ) . unwrap ( ) ;
262263
263264 write ! ( expiry_file, "{}" , encoded_expires) . with_context ( || {
Original file line number Diff line number Diff line change @@ -52,6 +52,8 @@ impl CacheBuilder {
5252
5353 let mut header_values = Vec :: with_capacity ( 1 ) ;
5454 expiry_date. encode ( & mut header_values) ;
55+ // Since we just `.encode()`d into `header_values, it is guaranteed to
56+ // have a `.first()`.
5557 let encoded_expiry_date = header_values. first ( ) . unwrap ( ) ;
5658
5759 let mut expiry_file = File :: create ( & self . expiry_path ) . unwrap_or_else ( |e| {
You can’t perform that action at this time.
0 commit comments