Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgrade to rust 1.58 #13377

Merged
merged 3 commits into from
Jan 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jobs:
- name: Install Rust
uses: hecrj/setup-rust-action@v1
with:
rust-version: 1.57.0
rust-version: 1.58.0

- name: Install clippy and rustfmt
if: matrix.job == 'lint'
Expand Down
2 changes: 1 addition & 1 deletion cli/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ impl fmt::Display for Diagnostics {
if i > 0 {
write!(f, "\n\n")?;
}
write!(f, "{}", item.to_string())?;
write!(f, "{}", item)?;
i += 1;
}

Expand Down
2 changes: 1 addition & 1 deletion cli/file_watcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ where
{
let result = watch_future.await;
if let Err(err) = result {
let msg = format!("{}: {}", colors::red_bold("error"), err.to_string(),);
let msg = format!("{}: {}", colors::red_bold("error"), err);
eprintln!("{}", msg);
}
}
Expand Down
2 changes: 1 addition & 1 deletion cli/fmt_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ fn format_frame(frame: &JsStackFrame) -> String {
if frame.is_promise_all {
result += &italic_bold(&format!(
"Promise.all (index {})",
frame.promise_index.unwrap_or_default().to_string()
frame.promise_index.unwrap_or_default()
))
.to_string();
return result;
Expand Down
6 changes: 3 additions & 3 deletions cli/graph_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ impl GraphData {
if !range.specifier.as_str().contains("$deno") {
return Some(Err(custom_error(
get_error_class_name(&error.clone().into()),
format!("{}\n at {}", error.to_string(), range),
format!("{}\n at {}", error, range),
)));
}
return Some(Err(error.clone().into()));
Expand All @@ -307,7 +307,7 @@ impl GraphData {
if !range.specifier.as_str().contains("$deno") {
return Some(Err(custom_error(
get_error_class_name(&error.clone().into()),
format!("{}\n at {}", error.to_string(), range),
format!("{}\n at {}", error, range),
)));
}
return Some(Err(error.clone().into()));
Expand All @@ -323,7 +323,7 @@ impl GraphData {
if !range.specifier.as_str().contains("$deno") {
return Some(Err(custom_error(
get_error_class_name(&error.clone().into()),
format!("{}\n at {}", error.to_string(), range),
format!("{}\n at {}", error, range),
)));
}
return Some(Err(error.clone().into()));
Expand Down
12 changes: 2 additions & 10 deletions cli/lsp/completions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -428,18 +428,10 @@ fn relative_specifier(
}
}
if parts.is_empty() {
format!(
"./{}{}",
last_a,
specifier[Position::AfterPath..].to_string()
)
format!("./{}{}", last_a, &specifier[Position::AfterPath..])
} else {
parts.push(last_a);
format!(
"{}{}",
parts.join("/"),
specifier[Position::AfterPath..].to_string()
)
format!("{}{}", parts.join("/"), &specifier[Position::AfterPath..])
}
} else {
specifier[Position::BeforePath..].into()
Expand Down
4 changes: 2 additions & 2 deletions cli/lsp/documents.rs
Original file line number Diff line number Diff line change
Expand Up @@ -588,8 +588,8 @@ pub(crate) fn to_hover_text(
"blob" => "_(a blob url)_".to_string(),
_ => format!(
"{}​{}",
specifier[..url::Position::AfterScheme].to_string(),
specifier[url::Position::AfterScheme..].to_string()
&specifier[..url::Position::AfterScheme],
&specifier[url::Position::AfterScheme..],
)
.replace('@', "​@"),
},
Expand Down
8 changes: 4 additions & 4 deletions cli/tools/installer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,11 +304,11 @@ pub fn install(
}

if let Some(inspect) = flags.inspect {
executable_args.push(format!("--inspect={}", inspect.to_string()));
executable_args.push(format!("--inspect={}", inspect));
}

if let Some(inspect_brk) = flags.inspect_brk {
executable_args.push(format!("--inspect-brk={}", inspect_brk.to_string()));
executable_args.push(format!("--inspect-brk={}", inspect_brk));
}

if let Some(import_map_path) = flags.import_map_path {
Expand Down Expand Up @@ -1040,12 +1040,12 @@ mod tests {

let mut expected_string = format!(
"--import-map '{}' 'http://localhost:4545/cat.ts'",
import_map_url.to_string()
import_map_url
);
if cfg!(windows) {
expected_string = format!(
"\"--import-map\" \"{}\" \"http://localhost:4545/cat.ts\"",
import_map_url.to_string()
import_map_url
);
}

Expand Down
12 changes: 2 additions & 10 deletions cli/tools/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,7 @@ impl PrettyTestReporter {
print!("{}", " ".repeat(description.level));
}

println!(
"{} {}",
status,
colors::gray(human_elapsed(elapsed.into())).to_string()
);
println!("{} {}", status, colors::gray(human_elapsed(elapsed.into())));

if let Some(error_text) = result.error() {
for line in error_text.lines() {
Expand Down Expand Up @@ -357,11 +353,7 @@ impl TestReporter for PrettyTestReporter {
print!(" ");
}

println!(
"{} {}",
status,
colors::gray(human_elapsed(elapsed.into())).to_string()
);
println!("{} {}", status, colors::gray(human_elapsed(elapsed.into())));
}

fn report_step_wait(&mut self, description: &TestStepDescription) {
Expand Down
1 change: 1 addition & 0 deletions core/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ impl ErrWithV8Handle {
}
}

#[allow(clippy::non_send_fields_in_send_ty)]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are suspect. Probably ok?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, It's probably going to be allowed by default rust-lang/rust-clippy#8045

unsafe impl Send for ErrWithV8Handle {}
unsafe impl Sync for ErrWithV8Handle {}

Expand Down
2 changes: 1 addition & 1 deletion core/module_specifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl fmt::Display for ModuleResolutionError {
specifier,
match maybe_referrer {
Some(referrer) => format!(" from \"{}\"", referrer),
None => format!(""),
None => String::new(),
}
),
}
Expand Down
4 changes: 2 additions & 2 deletions ext/ffi/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ struct Symbol {
result_type: NativeType,
}

#[allow(clippy::non_send_fields_in_send_ty)]
unsafe impl Send for Symbol {}
unsafe impl Sync for Symbol {}

Expand Down Expand Up @@ -92,8 +93,7 @@ impl DynamicLibraryResource {
Ok(value) => Ok(value),
Err(err) => Err(generic_error(format!(
"Failed to register symbol {}: {}",
symbol,
err.to_string()
symbol, err
))),
}?;
let ptr = libffi::middle::CodePtr::from_ptr(fn_ptr as _);
Expand Down
2 changes: 1 addition & 1 deletion ext/websocket/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ where
.map_err(|err| {
DomExceptionNetworkError::new(&format!(
"failed to connect to WebSocket: {}",
err.to_string()
err
))
})?;

Expand Down
8 changes: 2 additions & 6 deletions runtime/inspector_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,7 @@ fn handle_ws_request(
_ => http::Response::builder()
.status(http::StatusCode::BAD_REQUEST)
.body("Not a valid Websocket Request".into()),
});

if resp.is_err() {
return resp;
}
})?;

let (parts, _) = req.into_parts();
let req = http::Request::from_parts(parts, body);
Expand Down Expand Up @@ -193,7 +189,7 @@ fn handle_ws_request(
pump_websocket_messages(websocket, inbound_tx, outbound_rx).await;
});

resp
Ok(resp)
}

fn handle_json_request(
Expand Down
1 change: 1 addition & 0 deletions runtime/js.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use log::debug;
use once_cell::sync::Lazy;

pub static CLI_SNAPSHOT: Lazy<Box<[u8]>> = Lazy::new(
#[allow(clippy::uninit_vec)]
#[cold]
#[inline(never)]
|| {
Expand Down
6 changes: 3 additions & 3 deletions runtime/permissions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1918,7 +1918,7 @@ fn permission_prompt(message: &str) -> bool {
if success != TRUE {
panic!(
"Error flushing console input buffer: {}",
std::io::Error::last_os_error().to_string()
std::io::Error::last_os_error()
)
}
}
Expand All @@ -1941,7 +1941,7 @@ fn permission_prompt(message: &str) -> bool {
if success != TRUE {
panic!(
"Error emulating enter key press: {}",
std::io::Error::last_os_error().to_string()
std::io::Error::last_os_error()
)
}
}
Expand All @@ -1954,7 +1954,7 @@ fn permission_prompt(message: &str) -> bool {
if success != TRUE {
panic!(
"Error peeking console input buffer: {}",
std::io::Error::last_os_error().to_string()
std::io::Error::last_os_error()
)
}
events_read == 0
Expand Down
1 change: 1 addition & 0 deletions test_util/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,7 @@ impl hyper::server::accept::Accept for HyperAcceptor<'_> {
}
}

#[allow(clippy::non_send_fields_in_send_ty)]
unsafe impl std::marker::Send for HyperAcceptor<'_> {}

async fn wrap_redirect_server() {
Expand Down