no unused method params

This commit is contained in:
Dave Gauer 2021-06-30 19:28:27 -04:00
parent 290ba908ec
commit 76287cad45
2 changed files with 5 additions and 1 deletions

View file

@ -50,12 +50,16 @@ const RubberDuck = struct {
} }
fn quack(self: RubberDuck) void { fn quack(self: RubberDuck) void {
// Assigning an expression to '_' allows us to safely
// "use" the value while also ignoring it.
_ = self;
print("\"Squeek!\" ", .{}); print("\"Squeek!\" ", .{});
} }
fn listen(self: RubberDuck, dev_talk: []const u8) void { fn listen(self: RubberDuck, dev_talk: []const u8) void {
// Listen to developer talk about programming problem. // Listen to developer talk about programming problem.
// Silently contemplate problem. Emit helpful sound. // Silently contemplate problem. Emit helpful sound.
_ = dev_talk;
self.quack(); self.quack();
} }
}; };

View file

@ -1,4 +1,4 @@
122,123c122,123 126,127c126,127
< const walks_like_duck = ???; < const walks_like_duck = ???;
< const quacks_like_duck = ???; < const quacks_like_duck = ???;
--- ---