Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
50797444
R
Rust
项目概览
int
/
Rust
12 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
50797444
编写于
4月 22, 2021
作者:
J
Joshua Nelson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove `PrimitiveType::as_str`
上级
132211bc
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
10 addition
and
41 deletion
+10
-41
src/librustdoc/clean/types.rs
src/librustdoc/clean/types.rs
+0
-31
src/librustdoc/html/format.rs
src/librustdoc/html/format.rs
+3
-3
src/librustdoc/json/conversions.rs
src/librustdoc/json/conversions.rs
+1
-1
src/librustdoc/passes/collect_intra_doc_links.rs
src/librustdoc/passes/collect_intra_doc_links.rs
+6
-6
未找到文件。
src/librustdoc/clean/types.rs
浏览文件 @
50797444
...
...
@@ -1767,37 +1767,6 @@ impl PrimitiveType {
}
}
crate
fn
as_str
(
&
self
)
->
&
'static
str
{
use
self
::
PrimitiveType
::
*
;
match
*
self
{
Isize
=>
"isize"
,
I8
=>
"i8"
,
I16
=>
"i16"
,
I32
=>
"i32"
,
I64
=>
"i64"
,
I128
=>
"i128"
,
Usize
=>
"usize"
,
U8
=>
"u8"
,
U16
=>
"u16"
,
U32
=>
"u32"
,
U64
=>
"u64"
,
U128
=>
"u128"
,
F32
=>
"f32"
,
F64
=>
"f64"
,
Str
=>
"str"
,
Bool
=>
"bool"
,
Char
=>
"char"
,
Array
=>
"array"
,
Slice
=>
"slice"
,
Tuple
=>
"tuple"
,
Unit
=>
"unit"
,
RawPointer
=>
"pointer"
,
Reference
=>
"reference"
,
Fn
=>
"fn"
,
Never
=>
"never"
,
}
}
crate
fn
impls
(
&
self
,
tcx
:
TyCtxt
<
'_
>
)
->
&
'static
ArrayVec
<
DefId
,
4
>
{
Self
::
all_impls
(
tcx
)
.get
(
self
)
.expect
(
"missing impl for primitive type"
)
}
...
...
src/librustdoc/html/format.rs
浏览文件 @
50797444
...
...
@@ -574,7 +574,7 @@ fn primitive_link(
f
,
"<a class=
\"
primitive
\"
href=
\"
{}primitive.{}.html
\"
>"
,
"../"
.repeat
(
len
),
prim
.as_s
tr
()
prim
.as_s
ym
()
)
?
;
needs_termination
=
true
;
}
...
...
@@ -603,7 +603,7 @@ fn primitive_link(
f
,
"<a class=
\"
primitive
\"
href=
\"
{}/primitive.{}.html
\"
>"
,
loc
.join
(
"/"
),
prim
.as_s
tr
()
prim
.as_s
ym
()
)
?
;
needs_termination
=
true
;
}
...
...
@@ -677,7 +677,7 @@ fn fmt_type<'cx>(
fmt
::
Display
::
fmt
(
&
tybounds
(
param_names
,
cx
),
f
)
}
clean
::
Infer
=>
write!
(
f
,
"_"
),
clean
::
Primitive
(
prim
)
=>
primitive_link
(
f
,
prim
,
prim
.as_str
(),
cx
),
clean
::
Primitive
(
prim
)
=>
primitive_link
(
f
,
prim
,
&*
prim
.as_sym
()
.as_str
(),
cx
),
clean
::
BareFunction
(
ref
decl
)
=>
{
if
f
.alternate
()
{
write!
(
...
...
src/librustdoc/json/conversions.rs
浏览文件 @
50797444
...
...
@@ -379,7 +379,7 @@ fn from_tcx(ty: clean::Type, tcx: TyCtxt<'_>) -> Self {
.unwrap_or_default
(),
},
Generic
(
s
)
=>
Type
::
Generic
(
s
.to_string
()),
Primitive
(
p
)
=>
Type
::
Primitive
(
p
.as_s
tr
()
.to_string
()),
Primitive
(
p
)
=>
Type
::
Primitive
(
p
.as_s
ym
()
.to_string
()),
BareFunction
(
f
)
=>
Type
::
FunctionPointer
(
Box
::
new
((
*
f
)
.into_tcx
(
tcx
))),
Tuple
(
t
)
=>
Type
::
Tuple
(
t
.into_iter
()
.map
(|
x
|
x
.into_tcx
(
tcx
))
.collect
()),
Slice
(
t
)
=>
Type
::
Slice
(
Box
::
new
((
*
t
)
.into_tcx
(
tcx
))),
...
...
src/librustdoc/passes/collect_intra_doc_links.rs
浏览文件 @
50797444
...
...
@@ -91,10 +91,10 @@ fn article(self) -> &'static str {
}
}
fn
name
(
self
,
tcx
:
TyCtxt
<
'_
>
)
->
S
tring
{
fn
name
(
self
,
tcx
:
TyCtxt
<
'_
>
)
->
S
ymbol
{
match
self
{
Res
::
Def
(
_
,
id
)
=>
tcx
.item_name
(
id
)
.to_string
()
,
Res
::
Primitive
(
prim
)
=>
prim
.as_s
tr
()
.to_string
(),
Res
::
Def
(
_
,
id
)
=>
tcx
.item_name
(
id
),
Res
::
Primitive
(
prim
)
=>
prim
.as_s
ym
(),
}
}
...
...
@@ -388,7 +388,7 @@ fn resolve_primitive_associated_item(
ty
::
AssocKind
::
Const
=>
"associatedconstant"
,
ty
::
AssocKind
::
Type
=>
"associatedtype"
,
};
let
fragment
=
format!
(
"{}#{}.{}"
,
prim_ty
.as_s
tr
(),
out
,
item_name
);
let
fragment
=
format!
(
"{}#{}.{}"
,
prim_ty
.as_s
ym
(),
out
,
item_name
);
(
Res
::
Primitive
(
prim_ty
),
fragment
,
Some
((
kind
.as_def_kind
(),
item
.def_id
)))
})
})
...
...
@@ -481,7 +481,7 @@ fn resolve<'path>(
AnchorFailure
::
RustdocAnchorConflict
(
res
),
));
}
return
Ok
((
res
,
Some
(
ty
.as_s
tr
()
.to_owned
())));
return
Ok
((
res
,
Some
(
ty
.as_s
ym
()
.to_string
())));
}
_
=>
return
Ok
((
res
,
extra_fragment
.clone
())),
}
...
...
@@ -1148,7 +1148,7 @@ fn resolve_link(
return
None
;
}
res
=
prim
;
fragment
=
Some
(
prim
.name
(
self
.cx.tcx
));
fragment
=
Some
(
prim
.name
(
self
.cx.tcx
)
.to_string
()
);
}
else
{
// `[char]` when a `char` module is in scope
let
candidates
=
vec!
[
res
,
prim
];
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录