Use more Self keywords instead of repeating the type name.

This commit is contained in:
Dan Gohman
2018-10-05 16:40:50 -07:00
parent 9a1e966156
commit 17a9631981
16 changed files with 40 additions and 58 deletions

View File

@@ -74,8 +74,8 @@ pub struct InsertBuilder<'f, IIB: InstInserterBase<'f>> {
impl<'f, IIB: InstInserterBase<'f>> InsertBuilder<'f, IIB> {
/// Create a new builder which inserts instructions at `pos`.
/// The `dfg` and `pos.layout` references should be from the same `Function`.
pub fn new(inserter: IIB) -> InsertBuilder<'f, IIB> {
InsertBuilder {
pub fn new(inserter: IIB) -> Self {
Self {
inserter,
unused: PhantomData,
}
@@ -185,8 +185,8 @@ pub struct ReplaceBuilder<'f> {
impl<'f> ReplaceBuilder<'f> {
/// Create a `ReplaceBuilder` that will overwrite `inst`.
pub fn new(dfg: &'f mut DataFlowGraph, inst: Inst) -> ReplaceBuilder {
ReplaceBuilder { dfg, inst }
pub fn new(dfg: &'f mut DataFlowGraph, inst: Inst) -> Self {
Self { dfg, inst }
}
}

View File

@@ -782,8 +782,8 @@ mod tests {
impl<'f> LayoutCursor<'f> {
/// Create a new `LayoutCursor` for `layout`.
/// The cursor holds a mutable reference to `layout` for its entire lifetime.
pub fn new(layout: &'f mut Layout) -> LayoutCursor<'f> {
LayoutCursor {
pub fn new(layout: &'f mut Layout) -> Self {
Self {
layout,
pos: CursorPosition::Nowhere,
}