chore(cli,ext,rt): remove some unnecessary clone or malloc (#17261)

This commit is contained in:
Yiyu Lin 2023-01-04 20:20:36 +08:00 committed by GitHub
parent 2da882137e
commit 319f607476
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 23 additions and 18 deletions

View file

@ -79,10 +79,10 @@ pub fn check(
let root_names = get_tsc_roots(&segment_graph_data, check_js);
if options.log_checks {
for (root, _) in roots {
let root_str = root.to_string();
let root_str = root.as_str();
// `$deno` specifiers are internal, don't print them.
if !root_str.contains("$deno") {
log::info!("{} {}", colors::green("Check"), root);
log::info!("{} {}", colors::green("Check"), root_str);
}
}
}
@ -116,12 +116,20 @@ pub fn check(
let diagnostics = if options.type_check_mode == TypeCheckMode::Local {
response.diagnostics.filter(|d| {
if let Some(file_name) = &d.file_name {
!file_name.starts_with("http")
&& ModuleSpecifier::parse(file_name)
if !file_name.starts_with("http") {
if ModuleSpecifier::parse(file_name)
.map(|specifier| !npm_resolver.in_npm_package(&specifier))
.unwrap_or(true)
{
Some(d.clone())
} else {
None
}
} else {
None
}
} else {
true
Some(d.clone())
}
})
} else {