1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00

chore: update to Rust 1.73 (#20781)

This commit is contained in:
林炳权 2023-10-06 02:49:09 +08:00 committed by GitHub
parent ab3c9d41e4
commit 7a01799f49
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 30 additions and 40 deletions

View file

@ -5,7 +5,7 @@ import * as yaml from "https://deno.land/std@0.173.0/encoding/yaml.ts";
// Bump this number when you want to purge the cache. // Bump this number when you want to purge the cache.
// Note: the tools/release/01_bump_crate_versions.ts script will update this version // Note: the tools/release/01_bump_crate_versions.ts script will update this version
// automatically via regex, so ensure that this line maintains this format. // automatically via regex, so ensure that this line maintains this format.
const cacheVersion = 54; const cacheVersion = 55;
const Runners = (() => { const Runners = (() => {
const ubuntuRunner = "ubuntu-22.04"; const ubuntuRunner = "ubuntu-22.04";

View file

@ -315,8 +315,8 @@ jobs:
path: |- path: |-
~/.cargo/registry/index ~/.cargo/registry/index
~/.cargo/registry/cache ~/.cargo/registry/cache
key: '54-cargo-home-${{ matrix.os }}-${{ hashFiles(''Cargo.lock'') }}' key: '55-cargo-home-${{ matrix.os }}-${{ hashFiles(''Cargo.lock'') }}'
restore-keys: '54-cargo-home-${{ matrix.os }}' restore-keys: '55-cargo-home-${{ matrix.os }}'
if: '!(github.event_name == ''pull_request'' && matrix.skip_pr)' if: '!(github.event_name == ''pull_request'' && matrix.skip_pr)'
- name: Restore cache build output (PR) - name: Restore cache build output (PR)
uses: actions/cache/restore@v3 uses: actions/cache/restore@v3
@ -328,7 +328,7 @@ jobs:
!./target/*/*.zip !./target/*/*.zip
!./target/*/*.tar.gz !./target/*/*.tar.gz
key: never_saved key: never_saved
restore-keys: '54-cargo-target-${{ matrix.os }}-${{ matrix.profile }}-${{ matrix.job }}-' restore-keys: '55-cargo-target-${{ matrix.os }}-${{ matrix.profile }}-${{ matrix.job }}-'
- name: Apply and update mtime cache - name: Apply and update mtime cache
if: '!(github.event_name == ''pull_request'' && matrix.skip_pr) && (!startsWith(github.ref, ''refs/tags/''))' if: '!(github.event_name == ''pull_request'' && matrix.skip_pr) && (!startsWith(github.ref, ''refs/tags/''))'
uses: ./.github/mtime_cache uses: ./.github/mtime_cache
@ -616,7 +616,7 @@ jobs:
!./target/*/gn_out !./target/*/gn_out
!./target/*/*.zip !./target/*/*.zip
!./target/*/*.tar.gz !./target/*/*.tar.gz
key: '54-cargo-target-${{ matrix.os }}-${{ matrix.profile }}-${{ matrix.job }}-${{ github.sha }}' key: '55-cargo-target-${{ matrix.os }}-${{ matrix.profile }}-${{ matrix.job }}-${{ github.sha }}'
publish-canary: publish-canary:
name: publish canary name: publish canary
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04

View file

@ -15,6 +15,7 @@ use deno_graph::ModuleError;
use deno_graph::ModuleGraphError; use deno_graph::ModuleGraphError;
use deno_graph::ResolutionError; use deno_graph::ResolutionError;
use import_map::ImportMapError; use import_map::ImportMapError;
use std::fmt::Write;
fn get_import_map_error_class(_: &ImportMapError) -> &'static str { fn get_import_map_error_class(_: &ImportMapError) -> &'static str {
"URIError" "URIError"
@ -70,7 +71,10 @@ pub fn get_error_class_name(e: &AnyError) -> &'static str {
log::warn!( log::warn!(
"Error '{}' contains boxed error of unknown type:{}", "Error '{}' contains boxed error of unknown type:{}",
e, e,
e.chain().map(|e| format!("\n {e:?}")).collect::<String>() e.chain().fold(String::new(), |mut output, e| {
let _ = write!(output, "\n {e:?}");
output
})
); );
} }
"Error" "Error"

View file

@ -149,8 +149,7 @@ pub mod cpu {
} }
pub fn linux() -> String { pub fn linux() -> String {
let info = let info = std::fs::read_to_string("/proc/cpuinfo").unwrap_or_default();
std::fs::read_to_string("/proc/cpuinfo").unwrap_or(String::new());
for line in info.lines() { for line in info.lines() {
let mut iter = line.split(':'); let mut iter = line.split(':');

View file

@ -244,7 +244,6 @@ async fn bench_specifiers(
let join_handles = specifiers.into_iter().map(move |specifier| { let join_handles = specifiers.into_iter().map(move |specifier| {
let worker_factory = worker_factory.clone(); let worker_factory = worker_factory.clone();
let permissions = permissions.clone(); let permissions = permissions.clone();
let specifier = specifier;
let sender = sender.clone(); let sender = sender.clone();
let options = option_for_handles.clone(); let options = option_for_handles.clone();
spawn_blocking(move || { spawn_blocking(move || {

View file

@ -26,7 +26,7 @@ pub fn merge_processes(
for script_cov in process_cov.result { for script_cov in process_cov.result {
url_to_scripts url_to_scripts
.entry(script_cov.url.clone()) .entry(script_cov.url.clone())
.or_insert_with(Vec::new) .or_default()
.push(script_cov); .push(script_cov);
} }
} }
@ -66,10 +66,7 @@ pub fn merge_scripts(
end: root_range_cov.end_char_offset, end: root_range_cov.end_char_offset,
} }
}; };
range_to_funcs range_to_funcs.entry(root_range).or_default().push(func_cov);
.entry(root_range)
.or_insert_with(Vec::new)
.push(func_cov);
} }
} }
@ -103,11 +100,7 @@ impl Ord for CharRange {
impl PartialOrd for CharRange { impl PartialOrd for CharRange {
fn partial_cmp(&self, other: &Self) -> Option<::std::cmp::Ordering> { fn partial_cmp(&self, other: &Self) -> Option<::std::cmp::Ordering> {
if self.start != other.start { Some(self.cmp(other))
self.start.partial_cmp(&other.start)
} else {
other.end.partial_cmp(&self.end)
}
} }
} }
@ -167,7 +160,7 @@ fn into_start_events<'a>(trees: Vec<&'a mut RangeTree<'a>>) -> Vec<StartEvent> {
for child in tree.children.drain(..) { for child in tree.children.drain(..) {
result result
.entry(child.start) .entry(child.start)
.or_insert_with(Vec::new) .or_default()
.push((parent_index, child)); .push((parent_index, child));
} }
} }
@ -294,7 +287,7 @@ fn merge_range_tree_children<'a>(
}; };
parent_to_nested parent_to_nested
.entry(parent_index) .entry(parent_index)
.or_insert_with(Vec::new) .or_default()
.push(child); .push(child);
} }
} }
@ -312,10 +305,7 @@ fn merge_range_tree_children<'a>(
flat_children[parent_index].push(tree); flat_children[parent_index].push(tree);
continue; continue;
} }
parent_to_nested parent_to_nested.entry(parent_index).or_default().push(tree);
.entry(parent_index)
.or_insert_with(Vec::new)
.push(tree);
} }
start_event_queue.set_pending_offset(open_range_end); start_event_queue.set_pending_offset(open_range_end);
open_range = Some(CharRange { open_range = Some(CharRange {

View file

@ -416,9 +416,7 @@ impl JupyterServer {
// Otherwise, executing multiple cells one-by-one might lead to output // Otherwise, executing multiple cells one-by-one might lead to output
// from various cells be grouped together in another cell result. // from various cells be grouped together in another cell result.
tokio::time::sleep(std::time::Duration::from_millis(5)).await; tokio::time::sleep(std::time::Duration::from_millis(5)).await;
} else { } else if let Some(exception_details) = exception_details {
let exception_details = exception_details.unwrap();
// Determine the exception value and name // Determine the exception value and name
let (name, message, stack) = let (name, message, stack) =
if let Some(exception) = exception_details.exception { if let Some(exception) = exception_details.exception {

View file

@ -9,6 +9,7 @@ use deno_runtime::deno_crypto::rand;
use deno_runtime::deno_node::PathClean; use deno_runtime::deno_node::PathClean;
use std::borrow::Cow; use std::borrow::Cow;
use std::env::current_dir; use std::env::current_dir;
use std::fmt::Write as FmtWrite;
use std::fs::OpenOptions; use std::fs::OpenOptions;
use std::io::Error; use std::io::Error;
use std::io::ErrorKind; use std::io::ErrorKind;
@ -57,9 +58,10 @@ pub fn atomic_write_file<T: AsRef<[u8]>>(
fn inner(file_path: &Path, data: &[u8], mode: u32) -> std::io::Result<()> { fn inner(file_path: &Path, data: &[u8], mode: u32) -> std::io::Result<()> {
let temp_file_path = { let temp_file_path = {
let rand: String = (0..4) let rand: String = (0..4).fold(String::new(), |mut output, _| {
.map(|_| format!("{:02x}", rand::random::<u8>())) let _ = write!(output, "{:02x}", rand::random::<u8>());
.collect(); output
});
let extension = format!("{rand}.tmp"); let extension = format!("{rand}.tmp");
file_path.with_extension(extension) file_path.with_extension(extension)
}; };

View file

@ -654,7 +654,7 @@ impl NodeResolver {
if !is_url { if !is_url {
let export_target = if pattern { let export_target = if pattern {
pattern_re pattern_re
.replace(&target, |_caps: &regex::Captures| subpath.clone()) .replace(&target, |_caps: &regex::Captures| subpath)
.to_string() .to_string()
} else { } else {
format!("{target}{subpath}") format!("{target}{subpath}")
@ -722,9 +722,7 @@ impl NodeResolver {
if pattern { if pattern {
let resolved_path_str = resolved_path.to_string_lossy(); let resolved_path_str = resolved_path.to_string_lossy();
let replaced = pattern_re let replaced = pattern_re
.replace(&resolved_path_str, |_caps: &regex::Captures| { .replace(&resolved_path_str, |_caps: &regex::Captures| subpath);
subpath.clone()
});
return Ok(PathBuf::from(replaced.to_string())); return Ok(PathBuf::from(replaced.to_string()));
} }
Ok(resolved_path.join(subpath).clean()) Ok(resolved_path.join(subpath).clean())
@ -777,8 +775,8 @@ impl NodeResolver {
let resolved_result = self.resolve_package_target( let resolved_result = self.resolve_package_target(
package_json_path, package_json_path,
target_item.to_owned(), target_item.to_owned(),
subpath.clone(), subpath,
package_subpath.clone(), package_subpath,
referrer, referrer,
referrer_kind, referrer_kind,
pattern, pattern,
@ -826,8 +824,8 @@ impl NodeResolver {
let resolved = self.resolve_package_target( let resolved = self.resolve_package_target(
package_json_path, package_json_path,
condition_target, condition_target,
subpath.clone(), subpath,
package_subpath.clone(), package_subpath,
referrer, referrer,
referrer_kind, referrer_kind,
pattern, pattern,

View file

@ -1,3 +1,3 @@
[toolchain] [toolchain]
channel = "1.72.1" channel = "1.73.0"
components = ["rustfmt", "clippy"] components = ["rustfmt", "clippy"]