Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
9ca0bd51
R
Rust
项目概览
int
/
Rust
大约 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
9ca0bd51
编写于
12月 15, 2021
作者:
M
Matthias Krüger
提交者:
GitHub
12月 15, 2021
浏览文件
操作
浏览文件
下载
差异文件
Rollup merge of #91880 - matthiaskrgr:clippy_perf_dec, r=jyn514
fix clippy::single_char_pattern perf findings
上级
df89fd20
97e844a0
变更
19
隐藏空白更改
内联
并排
Showing
19 changed file
with
36 addition
and
36 deletion
+36
-36
compiler/rustc_codegen_ssa/src/back/link.rs
compiler/rustc_codegen_ssa/src/back/link.rs
+2
-2
compiler/rustc_driver/src/lib.rs
compiler/rustc_driver/src/lib.rs
+5
-5
compiler/rustc_graphviz/src/lib.rs
compiler/rustc_graphviz/src/lib.rs
+1
-1
compiler/rustc_interface/src/passes.rs
compiler/rustc_interface/src/passes.rs
+1
-1
compiler/rustc_middle/src/lint.rs
compiler/rustc_middle/src/lint.rs
+2
-2
compiler/rustc_middle/src/mir/generic_graphviz.rs
compiler/rustc_middle/src/mir/generic_graphviz.rs
+2
-2
compiler/rustc_middle/src/mir/spanview.rs
compiler/rustc_middle/src/mir/spanview.rs
+6
-6
compiler/rustc_mir_transform/src/coverage/debug.rs
compiler/rustc_mir_transform/src/coverage/debug.rs
+1
-1
compiler/rustc_mir_transform/src/coverage/spans.rs
compiler/rustc_mir_transform/src/coverage/spans.rs
+1
-1
compiler/rustc_parse/src/parser/diagnostics.rs
compiler/rustc_parse/src/parser/diagnostics.rs
+1
-1
compiler/rustc_save_analysis/src/lib.rs
compiler/rustc_save_analysis/src/lib.rs
+1
-1
compiler/rustc_session/src/config.rs
compiler/rustc_session/src/config.rs
+1
-1
compiler/rustc_session/src/options.rs
compiler/rustc_session/src/options.rs
+1
-1
compiler/rustc_session/src/output.rs
compiler/rustc_session/src/output.rs
+1
-1
compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
...trait_selection/src/traits/error_reporting/suggestions.rs
+1
-1
src/librustdoc/html/render/cache.rs
src/librustdoc/html/render/cache.rs
+2
-2
src/librustdoc/html/render/mod.rs
src/librustdoc/html/render/mod.rs
+1
-1
src/librustdoc/passes/collect_intra_doc_links.rs
src/librustdoc/passes/collect_intra_doc_links.rs
+1
-1
src/librustdoc/theme.rs
src/librustdoc/theme.rs
+5
-5
未找到文件。
compiler/rustc_codegen_ssa/src/back/link.rs
浏览文件 @
9ca0bd51
...
...
@@ -2226,8 +2226,8 @@ fn add_static_crate<'a, B: ArchiveBuilder<'a>>(
continue
;
}
let
canonical
=
f
.replace
(
"-"
,
"_"
);
let
canonical_name
=
name
.replace
(
"-"
,
"_"
);
let
canonical
=
f
.replace
(
'-'
,
"_"
);
let
canonical_name
=
name
.replace
(
'-'
,
"_"
);
let
is_rust_object
=
canonical
.starts_with
(
&
canonical_name
)
&&
looks_like_rust_object_file
(
&
f
);
...
...
compiler/rustc_driver/src/lib.rs
浏览文件 @
9ca0bd51
...
...
@@ -872,7 +872,7 @@ fn sort_lint_groups(
let
print_lints
=
|
lints
:
Vec
<&
Lint
>
|
{
for
lint
in
lints
{
let
name
=
lint
.name_lower
()
.replace
(
"_"
,
"-"
);
let
name
=
lint
.name_lower
()
.replace
(
'_'
,
"-"
);
println!
(
" {} {:7.7} {}"
,
padded
(
&
name
),
...
...
@@ -908,10 +908,10 @@ fn sort_lint_groups(
let
print_lint_groups
=
|
lints
:
Vec
<
(
&
'static
str
,
Vec
<
LintId
>
)
>
|
{
for
(
name
,
to
)
in
lints
{
let
name
=
name
.to_lowercase
()
.replace
(
"_"
,
"-"
);
let
name
=
name
.to_lowercase
()
.replace
(
'_'
,
"-"
);
let
desc
=
to
.into_iter
()
.map
(|
x
|
x
.to_string
()
.replace
(
"_"
,
"-"
))
.map
(|
x
|
x
.to_string
()
.replace
(
'_'
,
"-"
))
.collect
::
<
Vec
<
String
>>
()
.join
(
", "
);
println!
(
" {} {}"
,
padded
(
&
name
),
desc
);
...
...
@@ -960,7 +960,7 @@ fn print_flag_list<T>(
println!
(
" {} {:>width$}=val -- {}"
,
cmdline_opt
,
name
.replace
(
"_"
,
"-"
),
name
.replace
(
'_'
,
"-"
),
desc
,
width
=
max_len
);
...
...
@@ -1015,7 +1015,7 @@ pub fn handle_options(args: &[String]) -> Option<getopts::Matches> {
.iter
()
.map
(|
&
(
name
,
..
)|
(
'C'
,
name
))
.chain
(
DB_OPTIONS
.iter
()
.map
(|
&
(
name
,
..
)|
(
'Z'
,
name
)))
.find
(|
&
(
_
,
name
)|
*
opt
==
name
.replace
(
"_"
,
"-"
))
.find
(|
&
(
_
,
name
)|
*
opt
==
name
.replace
(
'_'
,
"-"
))
.map
(|(
flag
,
_
)|
format!
(
"{}. Did you mean `-{} {}`?"
,
e
,
flag
,
opt
)),
_
=>
None
,
};
...
...
compiler/rustc_graphviz/src/lib.rs
浏览文件 @
9ca0bd51
...
...
@@ -472,7 +472,7 @@ fn edge_style(&'a self, _e: &Self::Edge) -> Style {
/// Escape tags in such a way that it is suitable for inclusion in a
/// Graphviz HTML label.
pub
fn
escape_html
(
s
:
&
str
)
->
String
{
s
.replace
(
"&"
,
"&"
)
.replace
(
"
\"
"
,
"""
)
.replace
(
"<"
,
"<"
)
.replace
(
">"
,
">"
)
s
.replace
(
'&'
,
"&"
)
.replace
(
'\"'
,
"""
)
.replace
(
'<'
,
"<"
)
.replace
(
'>'
,
">"
)
}
impl
<
'a
>
LabelText
<
'a
>
{
...
...
compiler/rustc_interface/src/passes.rs
浏览文件 @
9ca0bd51
...
...
@@ -584,7 +584,7 @@ fn output_conflicts_with_dir(output_paths: &[PathBuf]) -> Option<PathBuf> {
fn
escape_dep_filename
(
filename
:
&
str
)
->
String
{
// Apparently clang and gcc *only* escape spaces:
// https://llvm.org/klaus/clang/commit/9d50634cfc268ecc9a7250226dd5ca0e945240d4
filename
.replace
(
" "
,
"
\\
"
)
filename
.replace
(
' '
,
"
\\
"
)
}
// Makefile comments only need escaping newlines and `\`.
...
...
compiler/rustc_middle/src/lint.rs
浏览文件 @
9ca0bd51
...
...
@@ -295,7 +295,7 @@ fn struct_lint_level_impl(
Level
::
Allow
=>
"-A"
,
Level
::
ForceWarn
=>
"--force-warn"
,
};
let
hyphen_case_lint_name
=
name
.replace
(
"_"
,
"-"
);
let
hyphen_case_lint_name
=
name
.replace
(
'_'
,
"-"
);
if
lint_flag_val
.as_str
()
==
name
{
sess
.diag_note_once
(
&
mut
err
,
...
...
@@ -306,7 +306,7 @@ fn struct_lint_level_impl(
),
);
}
else
{
let
hyphen_case_flag_val
=
lint_flag_val
.as_str
()
.replace
(
"_"
,
"-"
);
let
hyphen_case_flag_val
=
lint_flag_val
.as_str
()
.replace
(
'_'
,
"-"
);
sess
.diag_note_once
(
&
mut
err
,
DiagnosticMessageId
::
from
(
lint
),
...
...
compiler/rustc_middle/src/mir/generic_graphviz.rs
浏览文件 @
9ca0bd51
...
...
@@ -126,7 +126,7 @@ pub fn write_node<W>(&self, node: G::Node, dark_mode: bool, w: &mut W) -> io::Re
write!
(
w
,
r#"<tr><td align="left" balign="left">{}</td></tr>"#
,
dot
::
escape_html
(
&
section
)
.replace
(
"
\n
"
,
"<br/>"
)
dot
::
escape_html
(
&
section
)
.replace
(
'\n'
,
"<br/>"
)
)
?
;
}
...
...
@@ -147,7 +147,7 @@ fn write_edges<W>(&self, source: G::Node, w: &mut W) -> io::Result<()>
let
src
=
self
.node
(
source
);
let
trg
=
self
.node
(
target
);
let
escaped_edge_label
=
if
let
Some
(
edge_label
)
=
edge_labels
.get
(
index
)
{
dot
::
escape_html
(
edge_label
)
.replace
(
"
\n
"
,
r#"<br align="left"/>"#
)
dot
::
escape_html
(
edge_label
)
.replace
(
'\n'
,
r#"<br align="left"/>"#
)
}
else
{
""
.to_owned
()
};
...
...
compiler/rustc_middle/src/mir/spanview.rs
浏览文件 @
9ca0bd51
...
...
@@ -681,13 +681,13 @@ fn hir_body<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Option<&'tcx rustc_hir::B
}
fn
escape_html
(
s
:
&
str
)
->
String
{
s
.replace
(
"&"
,
"&"
)
.replace
(
"<"
,
"<"
)
.replace
(
">"
,
">"
)
s
.replace
(
'&'
,
"&"
)
.replace
(
'<'
,
"<"
)
.replace
(
'>'
,
">"
)
}
fn
escape_attr
(
s
:
&
str
)
->
String
{
s
.replace
(
"&"
,
"&"
)
.replace
(
"
\"
"
,
"""
)
.replace
(
"'"
,
"'"
)
.replace
(
"<"
,
"<"
)
.replace
(
">"
,
">"
)
s
.replace
(
'&'
,
"&"
)
.replace
(
'\"'
,
"""
)
.replace
(
'\''
,
"'"
)
.replace
(
'<'
,
"<"
)
.replace
(
'>'
,
">"
)
}
compiler/rustc_mir_transform/src/coverage/debug.rs
浏览文件 @
9ca0bd51
...
...
@@ -148,7 +148,7 @@ fn from_env() -> Self {
let
mut
counter_format
=
ExpressionFormat
::
default
();
if
let
Ok
(
env_debug_options
)
=
std
::
env
::
var
(
RUSTC_COVERAGE_DEBUG_OPTIONS
)
{
for
setting_str
in
env_debug_options
.replace
(
" "
,
""
)
.replace
(
"-"
,
"_"
)
.split
(
','
)
{
for
setting_str
in
env_debug_options
.replace
(
' '
,
""
)
.replace
(
'-'
,
"_"
)
.split
(
','
)
{
let
(
option
,
value
)
=
match
setting_str
.split_once
(
'='
)
{
None
=>
(
setting_str
,
None
),
Some
((
k
,
v
))
=>
(
k
,
Some
(
v
)),
...
...
compiler/rustc_mir_transform/src/coverage/spans.rs
浏览文件 @
9ca0bd51
...
...
@@ -155,7 +155,7 @@ pub fn format<'tcx>(&self, tcx: TyCtxt<'tcx>, mir_body: &mir::Body<'tcx>) -> Str
format!
(
"{}
\n
{}"
,
source_range_no_file
(
tcx
,
&
self
.span
),
self
.format_coverage_statements
(
tcx
,
mir_body
)
.replace
(
"
\n
"
,
"
\n
"
),
self
.format_coverage_statements
(
tcx
,
mir_body
)
.replace
(
'\n'
,
"
\n
"
),
)
}
...
...
compiler/rustc_parse/src/parser/diagnostics.rs
浏览文件 @
9ca0bd51
...
...
@@ -2236,7 +2236,7 @@ pub(super) fn incorrect_move_async_order_found(
err
.span_suggestion
(
seq_span
,
"...or a vertical bar to match on multiple alternatives"
,
seq_snippet
.replace
(
","
,
" |"
),
seq_snippet
.replace
(
','
,
" |"
),
Applicability
::
MachineApplicable
,
);
}
...
...
compiler/rustc_save_analysis/src/lib.rs
浏览文件 @
9ca0bd51
...
...
@@ -1036,7 +1036,7 @@ fn find_config(supplied: Option<Config>) -> Config {
// Helper function to escape quotes in a string
fn
escape
(
s
:
String
)
->
String
{
s
.replace
(
"
\"
"
,
"
\"\"
"
)
s
.replace
(
'\"'
,
"
\"\"
"
)
}
// Helper function to determine if a span came from a
...
...
compiler/rustc_session/src/config.rs
浏览文件 @
9ca0bd51
...
...
@@ -1213,7 +1213,7 @@ pub fn get_cmd_lint_options(
if
lint_name
==
"help"
{
describe_lints
=
true
;
}
else
{
lint_opts_with_position
.push
((
arg_pos
,
lint_name
.replace
(
"-"
,
"_"
),
level
));
lint_opts_with_position
.push
((
arg_pos
,
lint_name
.replace
(
'-'
,
"_"
),
level
));
}
}
}
...
...
compiler/rustc_session/src/options.rs
浏览文件 @
9ca0bd51
...
...
@@ -335,7 +335,7 @@ fn build_options<O: Default>(
Some
((
k
,
v
))
=>
(
k
.to_string
(),
Some
(
v
)),
};
let
option_to_lookup
=
key
.replace
(
"-"
,
"_"
);
let
option_to_lookup
=
key
.replace
(
'-'
,
"_"
);
match
descrs
.iter
()
.find
(|(
name
,
..
)|
*
name
==
option_to_lookup
)
{
Some
((
_
,
setter
,
type_desc
,
_
))
=>
{
if
!
setter
(
&
mut
op
,
value
)
{
...
...
compiler/rustc_session/src/output.rs
浏览文件 @
9ca0bd51
...
...
@@ -85,7 +85,7 @@ pub fn find_crate_name(sess: &Session, attrs: &[ast::Attribute], input: &Input)
);
sess
.err
(
&
msg
);
}
else
{
return
validate
(
s
.replace
(
"-"
,
"_"
),
None
);
return
validate
(
s
.replace
(
'-'
,
"_"
),
None
);
}
}
}
...
...
compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
浏览文件 @
9ca0bd51
...
...
@@ -747,7 +747,7 @@ fn suggest_add_reference_to_arg(
let
msg
=
format!
(
"the trait bound `{}: {}` is not satisfied"
,
orig_ty
.to_string
()
,
orig_ty
,
old_ref
.print_only_trait_path
(),
);
if
has_custom_message
{
...
...
src/librustdoc/html/render/cache.rs
浏览文件 @
9ca0bd51
...
...
@@ -184,8 +184,8 @@ fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
})
.expect
(
"failed serde conversion"
)
// All these `replace` calls are because we have to go through JS string for JSON content.
.replace
(
r
"\"
,
r"\\"
)
.replace
(
"'"
,
r"\'"
)
.replace
(
r
#"\"#
,
r"\\"
)
.replace
(
r#"'"#
,
r"\'"
)
// We need to escape double quotes for the JSON.
.replace
(
"
\\\"
"
,
"
\\\\\"
"
)
)
...
...
src/librustdoc/html/render/mod.rs
浏览文件 @
9ca0bd51
...
...
@@ -989,7 +989,7 @@ fn attributes(it: &clean::Item) -> Vec<String> {
.iter
()
.filter_map
(|
attr
|
{
if
ALLOWED_ATTRIBUTES
.contains
(
&
attr
.name_or_empty
())
{
Some
(
pprust
::
attribute_to_string
(
attr
)
.replace
(
"
\n
"
,
""
)
.replace
(
" "
,
" "
))
Some
(
pprust
::
attribute_to_string
(
attr
)
.replace
(
'\n'
,
""
)
.replace
(
" "
,
" "
))
}
else
{
None
}
...
...
src/librustdoc/passes/collect_intra_doc_links.rs
浏览文件 @
9ca0bd51
...
...
@@ -963,7 +963,7 @@ fn preprocess_link<'a>(
return
None
;
}
let
stripped
=
ori_link
.link
.replace
(
"`"
,
""
);
let
stripped
=
ori_link
.link
.replace
(
'`'
,
""
);
let
mut
parts
=
stripped
.split
(
'#'
);
let
link
=
parts
.next
()
.unwrap
();
...
...
src/librustdoc/theme.rs
浏览文件 @
9ca0bd51
...
...
@@ -173,11 +173,11 @@ fn build_rule(v: &[u8], positions: &[usize]) -> String {
.map
(|
x
|
::
std
::
str
::
from_utf8
(
&
v
[
x
[
0
]
..
x
[
1
]])
.unwrap_or
(
""
))
.collect
::
<
String
>
()
.trim
()
.replace
(
"
\n
"
,
" "
)
.replace
(
"/"
,
""
)
.replace
(
"
\t
"
,
" "
)
.replace
(
"{"
,
""
)
.replace
(
"}"
,
""
)
.replace
(
'\n'
,
" "
)
.replace
(
'/'
,
""
)
.replace
(
'\t'
,
" "
)
.replace
(
'{'
,
""
)
.replace
(
'}'
,
""
)
.split
(
' '
)
.filter
(|
s
|
!
s
.is_empty
())
.collect
::
<
Vec
<&
str
>>
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录