Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
deno
提交
8477daa8
D
deno
项目概览
张重言
/
deno
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
deno
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
8477daa8
编写于
4月 17, 2019
作者:
B
Bert Belder
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix clippy warnings
上级
90c2b10f
变更
9
显示空白变更内容
内联
并排
Showing
9 changed file
with
22 addition
and
27 deletion
+22
-27
cli/deno_dir.rs
cli/deno_dir.rs
+1
-1
cli/flags.rs
cli/flags.rs
+2
-4
cli/ops.rs
cli/ops.rs
+1
-1
cli/state.rs
cli/state.rs
+1
-1
cli/tokio_util.rs
cli/tokio_util.rs
+0
-1
cli/worker.rs
cli/worker.rs
+2
-3
core/examples/http_bench.rs
core/examples/http_bench.rs
+2
-1
core/js_errors.rs
core/js_errors.rs
+7
-6
core/modules.rs
core/modules.rs
+6
-9
未找到文件。
cli/deno_dir.rs
浏览文件 @
8477daa8
...
@@ -652,7 +652,7 @@ fn fetch_remote_source_async(
...
@@ -652,7 +652,7 @@ fn fetch_remote_source_async(
filename
:
filename
.to_string
(),
filename
:
filename
.to_string
(),
media_type
:
map_content_type
(
media_type
:
map_content_type
(
&
p
,
&
p
,
maybe_content_type
.as_ref
()
.map
(
|
s
|
s
.as_str
()
),
maybe_content_type
.as_ref
()
.map
(
String
::
as_str
),
),
),
source_code
:
source
.as_bytes
()
.to_owned
(),
source_code
:
source
.as_bytes
()
.to_owned
(),
maybe_output_code_filename
:
None
,
maybe_output_code_filename
:
None
,
...
...
cli/flags.rs
浏览文件 @
8477daa8
...
@@ -96,7 +96,7 @@ static ENV_VARIABLES_HELP: &str = "ENVIRONMENT VARIABLES:
...
@@ -96,7 +96,7 @@ static ENV_VARIABLES_HELP: &str = "ENVIRONMENT VARIABLES:
NO_COLOR Set to disable color"
;
NO_COLOR Set to disable color"
;
fn
create_cli_app
<
'a
,
'b
>
()
->
App
<
'a
,
'b
>
{
fn
create_cli_app
<
'a
,
'b
>
()
->
App
<
'a
,
'b
>
{
let
cli_app
=
App
::
new
(
"deno"
)
App
::
new
(
"deno"
)
.bin_name
(
"deno"
)
.bin_name
(
"deno"
)
.global_settings
(
&
[
AppSettings
::
ColorNever
])
.global_settings
(
&
[
AppSettings
::
ColorNever
])
.settings
(
&
[
.settings
(
&
[
...
@@ -194,9 +194,7 @@ fn create_cli_app<'a, 'b>() -> App<'a, 'b> {
...
@@ -194,9 +194,7 @@ fn create_cli_app<'a, 'b>() -> App<'a, 'b> {
// AppSettings:AllowExternalSubcommand to treat it as an
// AppSettings:AllowExternalSubcommand to treat it as an
// entry point script
// entry point script
SubCommand
::
with_name
(
"<script>"
)
.about
(
"Script to run"
),
SubCommand
::
with_name
(
"<script>"
)
.about
(
"Script to run"
),
);
)
cli_app
}
}
#[cfg_attr(feature
=
"cargo-clippy"
,
allow(stutter))]
#[cfg_attr(feature
=
"cargo-clippy"
,
allow(stutter))]
...
...
cli/ops.rs
浏览文件 @
8477daa8
...
@@ -295,7 +295,7 @@ fn op_start(
...
@@ -295,7 +295,7 @@ fn op_start(
let
mut
builder
=
FlatBufferBuilder
::
new
();
let
mut
builder
=
FlatBufferBuilder
::
new
();
let
state
=
state
;
let
state
=
state
;
let
argv
=
state
.argv
.iter
()
.map
(
|
s
|
s
.as_str
()
)
.collect
::
<
Vec
<
_
>>
();
let
argv
=
state
.argv
.iter
()
.map
(
String
::
as_str
)
.collect
::
<
Vec
<
_
>>
();
let
argv_off
=
builder
.create_vector_of_strings
(
argv
.as_slice
());
let
argv_off
=
builder
.create_vector_of_strings
(
argv
.as_slice
());
let
cwd_path
=
std
::
env
::
current_dir
()
.unwrap
();
let
cwd_path
=
std
::
env
::
current_dir
()
.unwrap
();
...
...
cli/state.rs
浏览文件 @
8477daa8
...
@@ -90,7 +90,7 @@ impl ThreadSafeState {
...
@@ -90,7 +90,7 @@ impl ThreadSafeState {
argv_rest
:
Vec
<
String
>
,
argv_rest
:
Vec
<
String
>
,
dispatch_selector
:
ops
::
OpSelector
,
dispatch_selector
:
ops
::
OpSelector
,
)
->
Self
{
)
->
Self
{
let
custom_root
=
env
::
var
(
"DENO_DIR"
)
.map
(
|
s
|
s
.into
()
)
.ok
();
let
custom_root
=
env
::
var
(
"DENO_DIR"
)
.map
(
String
::
into
)
.ok
();
let
(
worker_in_tx
,
worker_in_rx
)
=
async_mpsc
::
channel
::
<
Buf
>
(
1
);
let
(
worker_in_tx
,
worker_in_rx
)
=
async_mpsc
::
channel
::
<
Buf
>
(
1
);
let
(
worker_out_tx
,
worker_out_rx
)
=
async_mpsc
::
channel
::
<
Buf
>
(
1
);
let
(
worker_out_tx
,
worker_out_rx
)
=
async_mpsc
::
channel
::
<
Buf
>
(
1
);
...
...
cli/tokio_util.rs
浏览文件 @
8477daa8
...
@@ -48,7 +48,6 @@ pub fn init<F>(f: F)
...
@@ -48,7 +48,6 @@ pub fn init<F>(f: F)
where
where
F
:
FnOnce
(),
F
:
FnOnce
(),
{
{
use
tokio_executor
;
let
rt
=
tokio
::
runtime
::
Runtime
::
new
()
.unwrap
();
let
rt
=
tokio
::
runtime
::
Runtime
::
new
()
.unwrap
();
let
mut
executor
=
rt
.executor
();
let
mut
executor
=
rt
.executor
();
let
mut
enter
=
tokio_executor
::
enter
()
.expect
(
"Multiple executors at once"
);
let
mut
enter
=
tokio_executor
::
enter
()
.expect
(
"Multiple executors at once"
);
...
...
cli/worker.rs
浏览文件 @
8477daa8
...
@@ -119,7 +119,7 @@ pub fn resolve_module_spec(
...
@@ -119,7 +119,7 @@ pub fn resolve_module_spec(
// two-character sequence U+002E FULL STOP, U+002F SOLIDUS (./), or the
// two-character sequence U+002E FULL STOP, U+002F SOLIDUS (./), or the
// three-character sequence U+002E FULL STOP, U+002E FULL STOP, U+002F
// three-character sequence U+002E FULL STOP, U+002E FULL STOP, U+002F
// SOLIDUS (../), return failure.
// SOLIDUS (../), return failure.
if
!
specifier
.starts_with
(
"/"
)
if
!
specifier
.starts_with
(
'/'
)
&&
!
specifier
.starts_with
(
"./"
)
&&
!
specifier
.starts_with
(
"./"
)
&&
!
specifier
.starts_with
(
"../"
)
&&
!
specifier
.starts_with
(
"../"
)
{
{
...
@@ -158,8 +158,7 @@ impl Loader for Worker {
...
@@ -158,8 +158,7 @@ impl Loader for Worker {
type
Error
=
DenoError
;
type
Error
=
DenoError
;
fn
resolve
(
specifier
:
&
str
,
referrer
:
&
str
)
->
Result
<
String
,
Self
::
Error
>
{
fn
resolve
(
specifier
:
&
str
,
referrer
:
&
str
)
->
Result
<
String
,
Self
::
Error
>
{
resolve_module_spec
(
specifier
,
referrer
)
resolve_module_spec
(
specifier
,
referrer
)
.map_err
(
DenoError
::
from
)
.map_err
(|
url_err
|
DenoError
::
from
(
url_err
))
}
}
/// Given an absolute url, load its source code.
/// Given an absolute url, load its source code.
...
...
core/examples/http_bench.rs
浏览文件 @
8477daa8
...
@@ -61,6 +61,7 @@ impl Into<Buf> for Record {
...
@@ -61,6 +61,7 @@ impl Into<Buf> for Record {
impl
From
<&
[
u8
]
>
for
Record
{
impl
From
<&
[
u8
]
>
for
Record
{
fn
from
(
s
:
&
[
u8
])
->
Record
{
fn
from
(
s
:
&
[
u8
])
->
Record
{
#[allow(clippy::cast_ptr_alignment)]
let
ptr
=
s
.as_ptr
()
as
*
const
i32
;
let
ptr
=
s
.as_ptr
()
as
*
const
i32
;
let
ints
=
unsafe
{
std
::
slice
::
from_raw_parts
(
ptr
,
4
)
};
let
ints
=
unsafe
{
std
::
slice
::
from_raw_parts
(
ptr
,
4
)
};
Record
{
Record
{
...
@@ -75,7 +76,7 @@ impl From<&[u8]> for Record {
...
@@ -75,7 +76,7 @@ impl From<&[u8]> for Record {
impl
From
<
Buf
>
for
Record
{
impl
From
<
Buf
>
for
Record
{
fn
from
(
buf
:
Buf
)
->
Record
{
fn
from
(
buf
:
Buf
)
->
Record
{
assert_eq!
(
buf
.len
(),
4
*
4
);
assert_eq!
(
buf
.len
(),
4
*
4
);
//let byte_len = buf.len();
#[allow(clippy::cast_ptr_alignment)]
let
ptr
=
Box
::
into_raw
(
buf
)
as
*
mut
[
i32
;
4
];
let
ptr
=
Box
::
into_raw
(
buf
)
as
*
mut
[
i32
;
4
];
let
ints
:
Box
<
[
i32
]
>
=
unsafe
{
Box
::
from_raw
(
ptr
)
};
let
ints
:
Box
<
[
i32
]
>
=
unsafe
{
Box
::
from_raw
(
ptr
)
};
assert_eq!
(
ints
.len
(),
4
);
assert_eq!
(
ints
.len
(),
4
);
...
...
core/js_errors.rs
浏览文件 @
8477daa8
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
// It would require calling into Rust from Error.prototype.prepareStackTrace.
// It would require calling into Rust from Error.prototype.prepareStackTrace.
use
serde_json
;
use
serde_json
;
use
serde_json
::
value
::
Value
;
use
std
::
fmt
;
use
std
::
fmt
;
use
std
::
str
;
use
std
::
str
;
...
@@ -214,12 +215,12 @@ impl JSError {
...
@@ -214,12 +215,12 @@ impl JSError {
let
script_resource_name
=
obj
let
script_resource_name
=
obj
.get
(
"scriptResourceName"
)
.get
(
"scriptResourceName"
)
.and_then
(|
v
|
v
.as_str
()
.map
(
String
::
from
));
.and_then
(|
v
|
v
.as_str
()
.map
(
String
::
from
));
let
line_number
=
obj
.get
(
"lineNumber"
)
.and_then
(
|
v
|
v
.as_i64
()
);
let
line_number
=
obj
.get
(
"lineNumber"
)
.and_then
(
Value
::
as_i64
);
let
start_position
=
obj
.get
(
"startPosition"
)
.and_then
(
|
v
|
v
.as_i64
()
);
let
start_position
=
obj
.get
(
"startPosition"
)
.and_then
(
Value
::
as_i64
);
let
end_position
=
obj
.get
(
"endPosition"
)
.and_then
(
|
v
|
v
.as_i64
()
);
let
end_position
=
obj
.get
(
"endPosition"
)
.and_then
(
Value
::
as_i64
);
let
error_level
=
obj
.get
(
"errorLevel"
)
.and_then
(
|
v
|
v
.as_i64
()
);
let
error_level
=
obj
.get
(
"errorLevel"
)
.and_then
(
Value
::
as_i64
);
let
start_column
=
obj
.get
(
"startColumn"
)
.and_then
(
|
v
|
v
.as_i64
()
);
let
start_column
=
obj
.get
(
"startColumn"
)
.and_then
(
Value
::
as_i64
);
let
end_column
=
obj
.get
(
"endColumn"
)
.and_then
(
|
v
|
v
.as_i64
()
);
let
end_column
=
obj
.get
(
"endColumn"
)
.and_then
(
Value
::
as_i64
);
let
frames_v
=
&
obj
[
"frames"
];
let
frames_v
=
&
obj
[
"frames"
];
if
!
frames_v
.is_array
()
{
if
!
frames_v
.is_array
()
{
...
...
core/modules.rs
浏览文件 @
8477daa8
...
@@ -202,7 +202,7 @@ impl<L: Loader> Future for RecursiveLoad<L> {
...
@@ -202,7 +202,7 @@ impl<L: Loader> Future for RecursiveLoad<L> {
return
Ok
(
Async
::
NotReady
);
return
Ok
(
Async
::
NotReady
);
}
}
let
root_id
=
self
.root_id
.unwrap
()
.clone
()
;
let
root_id
=
self
.root_id
.unwrap
();
let
mut
loader
=
self
.take_loader
();
let
mut
loader
=
self
.take_loader
();
let
(
isolate
,
modules
)
=
loader
.isolate_and_modules
();
let
(
isolate
,
modules
)
=
loader
.isolate_and_modules
();
let
result
=
{
let
result
=
{
...
@@ -460,14 +460,11 @@ mod tests {
...
@@ -460,14 +460,11 @@ mod tests {
fn
poll
(
&
mut
self
)
->
Poll
<
Self
::
Item
,
Self
::
Error
>
{
fn
poll
(
&
mut
self
)
->
Poll
<
Self
::
Item
,
Self
::
Error
>
{
self
.counter
+=
1
;
self
.counter
+=
1
;
if
self
.url
==
"never_ready.js"
{
if
self
.url
==
"never_ready.js"
// never_ready.js is never ready.
||
(
self
.url
==
"slow.js"
&&
self
.counter
<
2
)
return
Ok
(
Async
::
NotReady
);
{
}
else
if
self
.url
==
"slow.js"
{
if
self
.counter
<
2
{
return
Ok
(
Async
::
NotReady
);
return
Ok
(
Async
::
NotReady
);
}
}
}
match
mock_source_code
(
&
self
.url
)
{
match
mock_source_code
(
&
self
.url
)
{
Some
(
src
)
=>
Ok
(
Async
::
Ready
(
src
.to_string
())),
Some
(
src
)
=>
Ok
(
Async
::
Ready
(
src
.to_string
())),
None
=>
Err
(
MockError
::
LoadErr
),
None
=>
Err
(
MockError
::
LoadErr
),
...
@@ -560,7 +557,7 @@ mod tests {
...
@@ -560,7 +557,7 @@ mod tests {
assert_eq!
(
modules
.get_children
(
c_id
),
Some
(
&
vec!
[
"d.js"
.to_string
()]));
assert_eq!
(
modules
.get_children
(
c_id
),
Some
(
&
vec!
[
"d.js"
.to_string
()]));
assert_eq!
(
modules
.get_children
(
d_id
),
Some
(
&
vec!
[]));
assert_eq!
(
modules
.get_children
(
d_id
),
Some
(
&
vec!
[]));
}
else
{
}
else
{
assert
!
(
false
);
panic!
(
"this shouldn't happen"
);
}
}
}
}
...
@@ -619,7 +616,7 @@ mod tests {
...
@@ -619,7 +616,7 @@ mod tests {
])
])
);
);
}
else
{
}
else
{
assert
!
(
false
);
panic!
(
"this shouldn't happen"
);
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录