0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-03-03 17:34:47 -05:00

chore: upgrade to rust 1.58 (#13377)

This commit is contained in:
David Sherret 2022-01-15 01:10:12 -05:00 committed by GitHub
parent 903cb48fe9
commit ad224f53c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 29 additions and 46 deletions

View file

@ -85,7 +85,7 @@ jobs:
- name: Install Rust - name: Install Rust
uses: hecrj/setup-rust-action@v1 uses: hecrj/setup-rust-action@v1
with: with:
rust-version: 1.57.0 rust-version: 1.58.0
- name: Install clippy and rustfmt - name: Install clippy and rustfmt
if: matrix.job == 'lint' if: matrix.job == 'lint'

View file

@ -409,7 +409,7 @@ impl fmt::Display for Diagnostics {
if i > 0 { if i > 0 {
write!(f, "\n\n")?; write!(f, "\n\n")?;
} }
write!(f, "{}", item.to_string())?; write!(f, "{}", item)?;
i += 1; i += 1;
} }

View file

@ -60,7 +60,7 @@ where
{ {
let result = watch_future.await; let result = watch_future.await;
if let Err(err) = result { 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); eprintln!("{}", msg);
} }
} }

View file

@ -81,7 +81,7 @@ fn format_frame(frame: &JsStackFrame) -> String {
if frame.is_promise_all { if frame.is_promise_all {
result += &italic_bold(&format!( result += &italic_bold(&format!(
"Promise.all (index {})", "Promise.all (index {})",
frame.promise_index.unwrap_or_default().to_string() frame.promise_index.unwrap_or_default()
)) ))
.to_string(); .to_string();
return result; return result;

View file

@ -288,7 +288,7 @@ impl GraphData {
if !range.specifier.as_str().contains("$deno") { if !range.specifier.as_str().contains("$deno") {
return Some(Err(custom_error( return Some(Err(custom_error(
get_error_class_name(&error.clone().into()), 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())); return Some(Err(error.clone().into()));
@ -307,7 +307,7 @@ impl GraphData {
if !range.specifier.as_str().contains("$deno") { if !range.specifier.as_str().contains("$deno") {
return Some(Err(custom_error( return Some(Err(custom_error(
get_error_class_name(&error.clone().into()), 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())); return Some(Err(error.clone().into()));
@ -323,7 +323,7 @@ impl GraphData {
if !range.specifier.as_str().contains("$deno") { if !range.specifier.as_str().contains("$deno") {
return Some(Err(custom_error( return Some(Err(custom_error(
get_error_class_name(&error.clone().into()), 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())); return Some(Err(error.clone().into()));

View file

@ -428,18 +428,10 @@ fn relative_specifier(
} }
} }
if parts.is_empty() { if parts.is_empty() {
format!( format!("./{}{}", last_a, &specifier[Position::AfterPath..])
"./{}{}",
last_a,
specifier[Position::AfterPath..].to_string()
)
} else { } else {
parts.push(last_a); parts.push(last_a);
format!( format!("{}{}", parts.join("/"), &specifier[Position::AfterPath..])
"{}{}",
parts.join("/"),
specifier[Position::AfterPath..].to_string()
)
} }
} else { } else {
specifier[Position::BeforePath..].into() specifier[Position::BeforePath..].into()

View file

@ -588,8 +588,8 @@ pub(crate) fn to_hover_text(
"blob" => "_(a blob url)_".to_string(), "blob" => "_(a blob url)_".to_string(),
_ => format!( _ => format!(
"{}​{}", "{}​{}",
specifier[..url::Position::AfterScheme].to_string(), &specifier[..url::Position::AfterScheme],
specifier[url::Position::AfterScheme..].to_string() &specifier[url::Position::AfterScheme..],
) )
.replace('@', "​@"), .replace('@', "​@"),
}, },

View file

@ -342,11 +342,11 @@ fn resolve_shim_data(
} }
if let Some(inspect) = flags.inspect { 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 { 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 { if let Some(import_map_path) = &flags.import_map_path {
@ -989,12 +989,12 @@ mod tests {
let mut expected_string = format!( let mut expected_string = format!(
"--import-map '{}' 'http://localhost:4545/cat.ts'", "--import-map '{}' 'http://localhost:4545/cat.ts'",
import_map_url.to_string() import_map_url
); );
if cfg!(windows) { if cfg!(windows) {
expected_string = format!( expected_string = format!(
"\"--import-map\" \"{}\" \"http://localhost:4545/cat.ts\"", "\"--import-map\" \"{}\" \"http://localhost:4545/cat.ts\"",
import_map_url.to_string() import_map_url
); );
} }

View file

@ -267,11 +267,7 @@ impl PrettyTestReporter {
print!("{}", " ".repeat(description.level)); print!("{}", " ".repeat(description.level));
} }
println!( println!("{} {}", status, colors::gray(human_elapsed(elapsed.into())));
"{} {}",
status,
colors::gray(human_elapsed(elapsed.into())).to_string()
);
if let Some(error_text) = result.error() { if let Some(error_text) = result.error() {
for line in error_text.lines() { for line in error_text.lines() {
@ -357,11 +353,7 @@ impl TestReporter for PrettyTestReporter {
print!(" "); print!(" ");
} }
println!( println!("{} {}", status, colors::gray(human_elapsed(elapsed.into())));
"{} {}",
status,
colors::gray(human_elapsed(elapsed.into())).to_string()
);
} }
fn report_step_wait(&mut self, description: &TestStepDescription) { fn report_step_wait(&mut self, description: &TestStepDescription) {

View file

@ -372,6 +372,7 @@ impl ErrWithV8Handle {
} }
} }
#[allow(clippy::non_send_fields_in_send_ty)]
unsafe impl Send for ErrWithV8Handle {} unsafe impl Send for ErrWithV8Handle {}
unsafe impl Sync for ErrWithV8Handle {} unsafe impl Sync for ErrWithV8Handle {}

View file

@ -43,7 +43,7 @@ impl fmt::Display for ModuleResolutionError {
specifier, specifier,
match maybe_referrer { match maybe_referrer {
Some(referrer) => format!(" from \"{}\"", referrer), Some(referrer) => format!(" from \"{}\"", referrer),
None => format!(""), None => String::new(),
} }
), ),
} }

View file

@ -57,6 +57,7 @@ struct Symbol {
result_type: NativeType, result_type: NativeType,
} }
#[allow(clippy::non_send_fields_in_send_ty)]
unsafe impl Send for Symbol {} unsafe impl Send for Symbol {}
unsafe impl Sync for Symbol {} unsafe impl Sync for Symbol {}
@ -92,8 +93,7 @@ impl DynamicLibraryResource {
Ok(value) => Ok(value), Ok(value) => Ok(value),
Err(err) => Err(generic_error(format!( Err(err) => Err(generic_error(format!(
"Failed to register symbol {}: {}", "Failed to register symbol {}: {}",
symbol, symbol, err
err.to_string()
))), ))),
}?; }?;
let ptr = libffi::middle::CodePtr::from_ptr(fn_ptr as _); let ptr = libffi::middle::CodePtr::from_ptr(fn_ptr as _);

View file

@ -334,7 +334,7 @@ where
.map_err(|err| { .map_err(|err| {
DomExceptionNetworkError::new(&format!( DomExceptionNetworkError::new(&format!(
"failed to connect to WebSocket: {}", "failed to connect to WebSocket: {}",
err.to_string() err
)) ))
})?; })?;

View file

@ -152,11 +152,7 @@ fn handle_ws_request(
_ => http::Response::builder() _ => http::Response::builder()
.status(http::StatusCode::BAD_REQUEST) .status(http::StatusCode::BAD_REQUEST)
.body("Not a valid Websocket Request".into()), .body("Not a valid Websocket Request".into()),
}); })?;
if resp.is_err() {
return resp;
}
let (parts, _) = req.into_parts(); let (parts, _) = req.into_parts();
let req = http::Request::from_parts(parts, body); let req = http::Request::from_parts(parts, body);
@ -193,7 +189,7 @@ fn handle_ws_request(
pump_websocket_messages(websocket, inbound_tx, outbound_rx).await; pump_websocket_messages(websocket, inbound_tx, outbound_rx).await;
}); });
resp Ok(resp)
} }
fn handle_json_request( fn handle_json_request(

View file

@ -4,6 +4,7 @@ use log::debug;
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
pub static CLI_SNAPSHOT: Lazy<Box<[u8]>> = Lazy::new( pub static CLI_SNAPSHOT: Lazy<Box<[u8]>> = Lazy::new(
#[allow(clippy::uninit_vec)]
#[cold] #[cold]
#[inline(never)] #[inline(never)]
|| { || {

View file

@ -1918,7 +1918,7 @@ fn permission_prompt(message: &str) -> bool {
if success != TRUE { if success != TRUE {
panic!( panic!(
"Error flushing console input buffer: {}", "Error flushing console input buffer: {}",
std::io::Error::last_os_error().to_string() std::io::Error::last_os_error()
) )
} }
} }
@ -1941,7 +1941,7 @@ fn permission_prompt(message: &str) -> bool {
if success != TRUE { if success != TRUE {
panic!( panic!(
"Error emulating enter key press: {}", "Error emulating enter key press: {}",
std::io::Error::last_os_error().to_string() std::io::Error::last_os_error()
) )
} }
} }
@ -1954,7 +1954,7 @@ fn permission_prompt(message: &str) -> bool {
if success != TRUE { if success != TRUE {
panic!( panic!(
"Error peeking console input buffer: {}", "Error peeking console input buffer: {}",
std::io::Error::last_os_error().to_string() std::io::Error::last_os_error()
) )
} }
events_read == 0 events_read == 0

View file

@ -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<'_> {} unsafe impl std::marker::Send for HyperAcceptor<'_> {}
async fn wrap_redirect_server() { async fn wrap_redirect_server() {