about summary refs log tree commit diff
path: root/src/test/codegen/src-hash-algorithm/src-hash-algorithm-sha256.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-10-14 18:16:17 +0000
committerGitHub <noreply@github.com>2021-10-14 18:16:17 +0000
commite52d47a3b8211c46de9321f76a59ce5e9811a8f8 (patch)
tree118030f6959fc7e1d4a9b8c399113e84c09827a6 /src/test/codegen/src-hash-algorithm/src-hash-algorithm-sha256.rs
parenta30941e2a553156ef891fa38d6241535eac3ce6f (diff)
parentf84b0b32425b18301cabcecb61a485ad4a5c8bd4 (diff)
downloadrust-e52d47a3b8211c46de9321f76a59ce5e9811a8f8.tar.gz
rust-e52d47a3b8211c46de9321f76a59ce5e9811a8f8.zip
Merge #10539
10539: Add "generate delegate methods" assist r=Veykril a=yoshuawuyts

_Co-authored with `@rylev_.`

This patch adds a new assist: "generate delegate method" which creates a method that calls to a method defined on an inner field. Delegation is common when authoring newtypes, and having IDE support for this is the best way we can make this easier to author in Rust, bar adding language-level support for it. Thanks!

Closes #5944.

## Example

__before__
```rust
struct Age(u8);
impl Age {
    fn age(&self) -> u8 {
        self.0
    }
}

struct Person {
    ag$0e: Age,
}
```

__after__
```rust
struct Age(u8);
impl Age {
    fn age(&self) -> u8 {
        self.0
    }
}

struct Person {
    age: Age,
}

impl Person {
    $0fn age(&self) -> u8 {
        self.age.age()
    }
}
```

Co-authored-by: Ryan Levick <me@ryanlevick.com>
Co-authored-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
Diffstat (limited to 'src/test/codegen/src-hash-algorithm/src-hash-algorithm-sha256.rs')
0 files changed, 0 insertions, 0 deletions