summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
author林炳权 <695601626@qq.com>2024-01-02 06:22:48 +0800
committerGitHub <noreply@github.com>2024-01-01 23:22:48 +0100
commit96b581bdd2bedb31aa51c0a992686f27ed1a1f10 (patch)
tree3e141ed70531ff37f93eb25d4ae135b97f14b7a1 /cli
parent7e72f3af6152d4b62c2ea94d025dfa297a6b0cb4 (diff)
chore: update to Rust 1.75 (#21731)
Diffstat (limited to 'cli')
-rw-r--r--cli/args/mod.rs2
-rw-r--r--cli/cache/mod.rs2
-rw-r--r--cli/lsp/analysis.rs4
-rw-r--r--cli/lsp/code_lens.rs2
-rw-r--r--cli/lsp/config.rs4
-rw-r--r--cli/lsp/testing/collectors.rs6
-rw-r--r--cli/tests/integration/lsp_tests.rs2
-rw-r--r--cli/tools/coverage/merge.rs2
-rw-r--r--cli/tools/coverage/mod.rs1
-rw-r--r--cli/tools/task.rs2
-rw-r--r--cli/tsc/mod.rs1
11 files changed, 11 insertions, 17 deletions
diff --git a/cli/args/mod.rs b/cli/args/mod.rs
index 0ddffbe3c..6366ce260 100644
--- a/cli/args/mod.rs
+++ b/cli/args/mod.rs
@@ -17,9 +17,7 @@ use deno_semver::npm::NpmPackageReqReference;
use indexmap::IndexMap;
pub use deno_config::BenchConfig;
-pub use deno_config::CompilerOptions;
pub use deno_config::ConfigFile;
-pub use deno_config::EmitConfigOptions;
pub use deno_config::FilesConfig;
pub use deno_config::FmtOptionsConfig;
pub use deno_config::JsxImportSourceConfig;
diff --git a/cli/cache/mod.rs b/cli/cache/mod.rs
index c0189b83b..87ad23b10 100644
--- a/cli/cache/mod.rs
+++ b/cli/cache/mod.rs
@@ -45,7 +45,6 @@ pub use disk_cache::DiskCache;
pub use emit::EmitCache;
pub use incremental::IncrementalCache;
pub use module_info::ModuleInfoCache;
-pub use module_info::ModuleInfoCacheModuleAnalyzer;
pub use node::NodeAnalysisCache;
pub use parsed_source::ParsedSourceCache;
@@ -95,7 +94,6 @@ pub type GlobalHttpCache = deno_cache_dir::GlobalHttpCache<RealDenoCacheEnv>;
pub type LocalHttpCache = deno_cache_dir::LocalHttpCache<RealDenoCacheEnv>;
pub type LocalLspHttpCache =
deno_cache_dir::LocalLspHttpCache<RealDenoCacheEnv>;
-pub use deno_cache_dir::CachedUrlMetadata;
pub use deno_cache_dir::HttpCache;
/// A "wrapper" for the FileFetcher and DiskCache for the Deno CLI that provides
diff --git a/cli/lsp/analysis.rs b/cli/lsp/analysis.rs
index 2bff545c0..88ca47f67 100644
--- a/cli/lsp/analysis.rs
+++ b/cli/lsp/analysis.rs
@@ -423,11 +423,11 @@ fn fix_ts_import_action(
if action.fix_name == "import" {
let change = action
.changes
- .get(0)
+ .first()
.ok_or_else(|| anyhow!("Unexpected action changes."))?;
let text_change = change
.text_changes
- .get(0)
+ .first()
.ok_or_else(|| anyhow!("Missing text change."))?;
if let Some(captures) = IMPORT_SPECIFIER_RE.captures(&text_change.new_text)
{
diff --git a/cli/lsp/code_lens.rs b/cli/lsp/code_lens.rs
index 5330be5da..f2ac24840 100644
--- a/cli/lsp/code_lens.rs
+++ b/cli/lsp/code_lens.rs
@@ -98,7 +98,7 @@ impl DenoTestCollector {
}
fn check_call_expr(&mut self, node: &ast::CallExpr, range: &SourceRange) {
- if let Some(expr) = node.args.get(0).map(|es| es.expr.as_ref()) {
+ if let Some(expr) = node.args.first().map(|es| es.expr.as_ref()) {
match expr {
ast::Expr::Object(obj_lit) => {
for prop in &obj_lit.props {
diff --git a/cli/lsp/config.rs b/cli/lsp/config.rs
index b618495bd..e7839de3b 100644
--- a/cli/lsp/config.rs
+++ b/cli/lsp/config.rs
@@ -932,7 +932,7 @@ impl Config {
}
pub fn root_uri(&self) -> Option<&Url> {
- self.workspace_folders.get(0).map(|p| &p.0)
+ self.workspace_folders.first().map(|p| &p.0)
}
pub fn maybe_node_modules_dir_path(&self) -> Option<&PathBuf> {
@@ -1184,7 +1184,7 @@ fn specifier_enabled(
return true;
};
let (settings, mut folder_uri) = settings.get_for_specifier(specifier);
- folder_uri = folder_uri.or_else(|| workspace_folders.get(0).map(|f| &f.0));
+ folder_uri = folder_uri.or_else(|| workspace_folders.first().map(|f| &f.0));
let mut disable_paths = vec![];
let mut enable_paths = None;
if let Some(folder_uri) = folder_uri {
diff --git a/cli/lsp/testing/collectors.rs b/cli/lsp/testing/collectors.rs
index 9781672c6..a66e56948 100644
--- a/cli/lsp/testing/collectors.rs
+++ b/cli/lsp/testing/collectors.rs
@@ -23,7 +23,7 @@ fn visit_arrow(
test_module: &mut TestModule,
) {
if let Some((maybe_test_context, maybe_step_var)) =
- parse_test_context_param(arrow_expr.params.get(0))
+ parse_test_context_param(arrow_expr.params.first())
{
let mut collector = TestStepCollector::new(
maybe_test_context,
@@ -44,7 +44,7 @@ fn visit_fn(
test_module: &mut TestModule,
) {
if let Some((maybe_test_context, maybe_step_var)) =
- parse_test_context_param(function.params.get(0).map(|p| &p.pat))
+ parse_test_context_param(function.params.first().map(|p| &p.pat))
{
let mut collector = TestStepCollector::new(
maybe_test_context,
@@ -136,7 +136,7 @@ fn visit_call_expr(
text_info: &SourceTextInfo,
test_module: &mut TestModule,
) {
- if let Some(expr) = node.args.get(0).map(|es| es.expr.as_ref()) {
+ if let Some(expr) = node.args.first().map(|es| es.expr.as_ref()) {
match expr {
ast::Expr::Object(obj_lit) => {
let mut maybe_name = None;
diff --git a/cli/tests/integration/lsp_tests.rs b/cli/tests/integration/lsp_tests.rs
index ae93212c1..78aff93ab 100644
--- a/cli/tests/integration/lsp_tests.rs
+++ b/cli/tests/integration/lsp_tests.rs
@@ -4481,7 +4481,7 @@ fn test_lsp_code_actions_ordering() {
let action = action.as_object_mut().unwrap();
let title = action.get("title").unwrap().as_str().unwrap().to_string();
let diagnostics = action.get("diagnostics").unwrap().as_array().unwrap();
- let diagnostic = diagnostics.get(0).unwrap().as_object().unwrap();
+ let diagnostic = diagnostics.first().unwrap().as_object().unwrap();
let source = diagnostic.get("source").unwrap();
let source = source.as_str().unwrap().to_string();
action.clear();
diff --git a/cli/tools/coverage/merge.rs b/cli/tools/coverage/merge.rs
index 9c6a3e93d..81317df55 100644
--- a/cli/tools/coverage/merge.rs
+++ b/cli/tools/coverage/merge.rs
@@ -347,7 +347,7 @@ fn merge_range_tree_children<'a>(
let mut result: Vec<&'a mut RangeTree<'a>> = Vec::new();
for event in events.iter() {
let mut matching_trees: Vec<&'a mut RangeTree<'a>> = Vec::new();
- for (_parent_index, children) in child_forests.iter_mut().enumerate() {
+ for children in child_forests.iter_mut() {
let next_tree: Option<&'a mut RangeTree<'a>> = {
if children
.peek()
diff --git a/cli/tools/coverage/mod.rs b/cli/tools/coverage/mod.rs
index 3a1a10c39..9c42a5fd9 100644
--- a/cli/tools/coverage/mod.rs
+++ b/cli/tools/coverage/mod.rs
@@ -364,7 +364,6 @@ fn generate_coverage_report(
line_counts
.into_iter()
.enumerate()
- .map(|(index, count)| (index, count))
.collect::<Vec<(usize, i64)>>()
};
diff --git a/cli/tools/task.rs b/cli/tools/task.rs
index db5977391..ffeea7460 100644
--- a/cli/tools/task.rs
+++ b/cli/tools/task.rs
@@ -255,7 +255,7 @@ impl ShellCommand for NpxCommand {
&self,
mut context: ShellCommandContext,
) -> LocalBoxFuture<'static, ExecuteResult> {
- if let Some(first_arg) = context.args.get(0).cloned() {
+ if let Some(first_arg) = context.args.first().cloned() {
if let Some(command) = context.state.resolve_command(&first_arg) {
let context = ShellCommandContext {
args: context.args.iter().skip(1).cloned().collect::<Vec<_>>(),
diff --git a/cli/tsc/mod.rs b/cli/tsc/mod.rs
index f745597b6..4e9b6110b 100644
--- a/cli/tsc/mod.rs
+++ b/cli/tsc/mod.rs
@@ -50,7 +50,6 @@ mod diagnostics;
pub use self::diagnostics::Diagnostic;
pub use self::diagnostics::DiagnosticCategory;
-pub use self::diagnostics::DiagnosticMessageChain;
pub use self::diagnostics::Diagnostics;
pub use self::diagnostics::Position;