Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
f8618486
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,发现更多精彩内容 >>
提交
f8618486
编写于
7月 31, 2014
作者:
O
OGINO Masanori
提交者:
Alex Crichton
7月 31, 2014
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
alloc, arena, test, url, uuid: Elide lifetimes.
Signed-off-by:
N
OGINO Masanori
<
masanori.ogino@gmail.com
>
上级
2467c6e5
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
18 addition
and
19 deletion
+18
-19
src/liballoc/rc.rs
src/liballoc/rc.rs
+5
-5
src/libarena/lib.rs
src/libarena/lib.rs
+6
-6
src/libtest/stats.rs
src/libtest/stats.rs
+1
-1
src/liburl/lib.rs
src/liburl/lib.rs
+5
-6
src/libuuid/lib.rs
src/libuuid/lib.rs
+1
-1
未找到文件。
src/liballoc/rc.rs
浏览文件 @
f8618486
...
...
@@ -226,7 +226,7 @@ impl<T: Clone> Rc<T> {
/// data is cloned if the reference count is greater than one.
#[inline]
#[experimental]
pub
fn
make_unique
<
'a
>
(
&
'a
mut
self
)
->
&
'a
mut
T
{
pub
fn
make_unique
(
&
mut
self
)
->
&
mut
T
{
// Note that we hold a strong reference, which also counts as
// a weak reference, so we only clone if there is an
// additional reference of either kind.
...
...
@@ -247,7 +247,7 @@ pub fn make_unique<'a>(&'a mut self) -> &'a mut T {
impl
<
T
>
Deref
<
T
>
for
Rc
<
T
>
{
/// Borrow the value contained in the reference-counted box
#[inline(always)]
fn
deref
<
'a
>
(
&
'a
self
)
->
&
'a
T
{
fn
deref
(
&
self
)
->
&
T
{
&
self
.inner
()
.value
}
}
...
...
@@ -390,7 +390,7 @@ fn clone(&self) -> Weak<T> {
#[doc(hidden)]
trait
RcBoxPtr
<
T
>
{
fn
inner
<
'a
>
(
&
'a
self
)
->
&
'a
RcBox
<
T
>
;
fn
inner
(
&
self
)
->
&
RcBox
<
T
>
;
#[inline]
fn
strong
(
&
self
)
->
uint
{
self
.inner
()
.strong
.get
()
}
...
...
@@ -413,12 +413,12 @@ fn weak(&self) -> uint { self.inner().weak.get() }
impl
<
T
>
RcBoxPtr
<
T
>
for
Rc
<
T
>
{
#[inline(always)]
fn
inner
<
'a
>
(
&
'a
self
)
->
&
'a
RcBox
<
T
>
{
unsafe
{
&
(
*
self
._ptr
)
}
}
fn
inner
(
&
self
)
->
&
RcBox
<
T
>
{
unsafe
{
&
(
*
self
._ptr
)
}
}
}
impl
<
T
>
RcBoxPtr
<
T
>
for
Weak
<
T
>
{
#[inline(always)]
fn
inner
<
'a
>
(
&
'a
self
)
->
&
'a
RcBox
<
T
>
{
unsafe
{
&
(
*
self
._ptr
)
}
}
fn
inner
(
&
self
)
->
&
RcBox
<
T
>
{
unsafe
{
&
(
*
self
._ptr
)
}
}
}
#[cfg(test)]
...
...
src/libarena/lib.rs
浏览文件 @
f8618486
...
...
@@ -207,7 +207,7 @@ fn alloc_copy_inner(&self, n_bytes: uint, align: uint) -> *const u8 {
}
#[inline]
fn
alloc_copy
<
'a
,
T
>
(
&
'a
self
,
op
:
||
->
T
)
->
&
'a
T
{
fn
alloc_copy
<
T
>
(
&
self
,
op
:
||
->
T
)
->
&
T
{
unsafe
{
let
ptr
=
self
.alloc_copy_inner
(
mem
::
size_of
::
<
T
>
(),
mem
::
min_align_of
::
<
T
>
());
...
...
@@ -261,7 +261,7 @@ fn alloc_noncopy_inner(&self, n_bytes: uint,
}
#[inline]
fn
alloc_noncopy
<
'a
,
T
>
(
&
'a
self
,
op
:
||
->
T
)
->
&
'a
T
{
fn
alloc_noncopy
<
T
>
(
&
self
,
op
:
||
->
T
)
->
&
T
{
unsafe
{
let
tydesc
=
get_tydesc
::
<
T
>
();
let
(
ty_ptr
,
ptr
)
=
...
...
@@ -285,7 +285,7 @@ fn alloc_noncopy<'a, T>(&'a self, op: || -> T) -> &'a T {
/// Allocate a new item in the arena, using `op` to initialize the value
/// and returning a reference to it.
#[inline]
pub
fn
alloc
<
'a
,
T
>
(
&
'a
self
,
op
:
||
->
T
)
->
&
'a
T
{
pub
fn
alloc
<
T
>
(
&
self
,
op
:
||
->
T
)
->
&
T
{
unsafe
{
if
intrinsics
::
needs_drop
::
<
T
>
()
{
self
.alloc_noncopy
(
op
)
...
...
@@ -458,13 +458,13 @@ pub fn with_capacity(capacity: uint) -> TypedArena<T> {
/// Allocates an object in the TypedArena, returning a reference to it.
#[inline]
pub
fn
alloc
<
'a
>
(
&
'a
self
,
object
:
T
)
->
&
'a
T
{
pub
fn
alloc
(
&
self
,
object
:
T
)
->
&
T
{
if
self
.ptr
==
self
.end
{
self
.grow
()
}
let
ptr
:
&
'a
T
=
unsafe
{
let
ptr
:
&
'a
mut
T
=
mem
::
transmute
(
self
.ptr
);
let
ptr
:
&
T
=
unsafe
{
let
ptr
:
&
mut
T
=
mem
::
transmute
(
self
.ptr
);
ptr
::
write
(
ptr
,
object
);
self
.ptr
.set
(
self
.ptr
.get
()
.offset
(
1
));
ptr
...
...
src/libtest/stats.rs
浏览文件 @
f8618486
...
...
@@ -164,7 +164,7 @@ pub fn new(samples: &[T]) -> Summary<T> {
}
}
impl
<
'a
,
T
:
FloatMath
+
FromPrimitive
>
Stats
<
T
>
for
&
'a
[
T
]
{
impl
<
'a
,
T
:
FloatMath
+
FromPrimitive
>
Stats
<
T
>
for
&
'a
[
T
]
{
// FIXME #11059 handle NaN, inf and overflow
fn
sum
(
self
)
->
T
{
...
...
src/liburl/lib.rs
浏览文件 @
f8618486
...
...
@@ -394,7 +394,7 @@ fn maybe_push_value(map: &mut HashMap<String, Vec<String>>,
}
}
fn
split_char_first
<
'a
>
(
s
:
&
'a
str
,
c
:
char
)
->
(
&
'a
str
,
&
'a
str
)
{
fn
split_char_first
(
s
:
&
str
,
c
:
char
)
->
(
&
str
,
&
str
)
{
let
mut
iter
=
s
.splitn
(
c
,
1
);
match
(
iter
.next
(),
iter
.next
())
{
...
...
@@ -466,7 +466,7 @@ pub fn query_to_str(query: &Query) -> String {
/// };
/// println!("Scheme in use: {}.", scheme); // Scheme in use: https.
/// ```
pub
fn
get_scheme
<
'a
>
(
rawurl
:
&
'a
str
)
->
DecodeResult
<
(
&
'a
str
,
&
'a
str
)
>
{
pub
fn
get_scheme
(
rawurl
:
&
str
)
->
DecodeResult
<
(
&
str
,
&
str
)
>
{
for
(
i
,
c
)
in
rawurl
.chars
()
.enumerate
()
{
let
result
=
match
c
{
'A'
..
'Z'
...
...
@@ -493,8 +493,8 @@ pub fn get_scheme<'a>(rawurl: &'a str) -> DecodeResult<(&'a str, &'a str)> {
}
// returns userinfo, host, port, and unparsed part, or an error
fn
get_authority
<
'a
>
(
rawurl
:
&
'a
str
)
->
DecodeResult
<
(
Option
<
UserInfo
>
,
&
'a
str
,
Option
<
u16
>
,
&
'a
str
)
>
{
fn
get_authority
(
rawurl
:
&
str
)
->
DecodeResult
<
(
Option
<
UserInfo
>
,
&
str
,
Option
<
u16
>
,
&
str
)
>
{
enum
State
{
Start
,
// starting state
PassHostPort
,
// could be in user or port
...
...
@@ -662,8 +662,7 @@ enum Input {
// returns the path and unparsed part of url, or an error
fn
get_path
<
'a
>
(
rawurl
:
&
'a
str
,
is_authority
:
bool
)
->
DecodeResult
<
(
String
,
&
'a
str
)
>
{
fn
get_path
(
rawurl
:
&
str
,
is_authority
:
bool
)
->
DecodeResult
<
(
String
,
&
str
)
>
{
let
len
=
rawurl
.len
();
let
mut
end
=
len
;
for
(
i
,
c
)
in
rawurl
.chars
()
.enumerate
()
{
...
...
src/libuuid/lib.rs
浏览文件 @
f8618486
...
...
@@ -313,7 +313,7 @@ pub fn get_version(&self) -> Option<UuidVersion> {
}
/// Return an array of 16 octets containing the UUID data
pub
fn
as_bytes
<
'a
>
(
&
'a
self
)
->
&
'a
[
u8
]
{
pub
fn
as_bytes
(
&
self
)
->
&
[
u8
]
{
self
.bytes
.as_slice
()
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录