1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-25 00:29:09 -05:00

upgrade: Rust 1.42.0 (#4331)

This commit is contained in:
Ryan Dahl 2020-03-12 13:07:57 -04:00 committed by GitHub
parent 63cee35691
commit 3ac642c183
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 15 deletions

View file

@ -48,7 +48,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.41.0" rust-version: "1.42.0"
- name: Install clippy and rustfmt - name: Install clippy and rustfmt
if: matrix.kind == 'lint' if: matrix.kind == 'lint'

View file

@ -43,11 +43,11 @@ pub fn op_query_permission(
) -> Result<JsonOp, OpError> { ) -> Result<JsonOp, OpError> {
let args: PermissionArgs = serde_json::from_value(args)?; let args: PermissionArgs = serde_json::from_value(args)?;
let state = state.borrow(); let state = state.borrow();
let resolved_path = args.path.as_ref().map(String::as_str).map(resolve_path); let resolved_path = args.path.as_deref().map(resolve_path);
let perm = state.permissions.get_permission_state( let perm = state.permissions.get_permission_state(
&args.name, &args.name,
&args.url.as_ref().map(String::as_str), &args.url.as_deref(),
&resolved_path.as_ref().map(String::as_str).map(Path::new), &resolved_path.as_deref().map(Path::new),
)?; )?;
Ok(JsonOp::Sync(json!({ "state": perm.to_string() }))) Ok(JsonOp::Sync(json!({ "state": perm.to_string() })))
} }
@ -70,11 +70,11 @@ pub fn op_revoke_permission(
"hrtime" => permissions.allow_hrtime.revoke(), "hrtime" => permissions.allow_hrtime.revoke(),
_ => {} _ => {}
}; };
let resolved_path = args.path.as_ref().map(String::as_str).map(resolve_path); let resolved_path = args.path.as_deref().map(resolve_path);
let perm = permissions.get_permission_state( let perm = permissions.get_permission_state(
&args.name, &args.name,
&args.url.as_ref().map(String::as_str), &args.url.as_deref(),
&resolved_path.as_ref().map(String::as_str).map(Path::new), &resolved_path.as_deref().map(Path::new),
)?; )?;
Ok(JsonOp::Sync(json!({ "state": perm.to_string() }))) Ok(JsonOp::Sync(json!({ "state": perm.to_string() })))
} }
@ -87,16 +87,16 @@ pub fn op_request_permission(
let args: PermissionArgs = serde_json::from_value(args)?; let args: PermissionArgs = serde_json::from_value(args)?;
let mut state = state.borrow_mut(); let mut state = state.borrow_mut();
let permissions = &mut state.permissions; let permissions = &mut state.permissions;
let resolved_path = args.path.as_ref().map(String::as_str).map(resolve_path); let resolved_path = args.path.as_deref().map(resolve_path);
let perm = match args.name.as_ref() { let perm = match args.name.as_ref() {
"run" => Ok(permissions.request_run()), "run" => Ok(permissions.request_run()),
"read" => Ok(permissions.request_read( "read" => {
&resolved_path.as_ref().map(String::as_str).map(Path::new), Ok(permissions.request_read(&resolved_path.as_deref().map(Path::new)))
)), }
"write" => Ok(permissions.request_write( "write" => {
&resolved_path.as_ref().map(String::as_str).map(Path::new), Ok(permissions.request_write(&resolved_path.as_deref().map(Path::new)))
)), }
"net" => permissions.request_net(&args.url.as_ref().map(String::as_str)), "net" => permissions.request_net(&args.url.as_deref()),
"env" => Ok(permissions.request_env()), "env" => Ok(permissions.request_env()),
"plugin" => Ok(permissions.request_plugin()), "plugin" => Ok(permissions.request_plugin()),
"hrtime" => Ok(permissions.request_hrtime()), "hrtime" => Ok(permissions.request_hrtime()),