Skip to content

Commit

Permalink
remove unused shit ass error
Browse files Browse the repository at this point in the history
  • Loading branch information
ryuukk committed Oct 26, 2024
1 parent 2b93d57 commit f95826d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions zig/lib/std/zig/AstGen.zig
Original file line number Diff line number Diff line change
Expand Up @@ -3098,7 +3098,7 @@ fn checkUsed(gz: *GenZir, outer_scope: *Scope, inner_scope: *Scope) InnerError!v
.local_val => {
const s = scope.cast(Scope.LocalVal).?;
if (s.used == 0 and s.discarded == 0) {
try astgen.appendErrorTok(s.token_src, "unused {s}", .{@tagName(s.id_cat)});
// try astgen.appendErrorTok(s.token_src, "unused {s}", .{@tagName(s.id_cat)});
} else if (s.used != 0 and s.discarded != 0) {
try astgen.appendErrorTokNotes(s.discarded, "pointless discard of {s}", .{@tagName(s.id_cat)}, &[_]u32{
try gz.astgen.errNoteTok(s.used, "used here", .{}),
Expand All @@ -3109,17 +3109,17 @@ fn checkUsed(gz: *GenZir, outer_scope: *Scope, inner_scope: *Scope) InnerError!v
.local_ptr => {
const s = scope.cast(Scope.LocalPtr).?;
if (s.used == 0 and s.discarded == 0) {
try astgen.appendErrorTok(s.token_src, "unused {s}", .{@tagName(s.id_cat)});
// try astgen.appendErrorTok(s.token_src, "unused {s}", .{@tagName(s.id_cat)});
} else {
if (s.used != 0 and s.discarded != 0) {
try astgen.appendErrorTokNotes(s.discarded, "pointless discard of {s}", .{@tagName(s.id_cat)}, &[_]u32{
try astgen.errNoteTok(s.used, "used here", .{}),
});
}
if (s.id_cat == .@"local variable" and !s.used_as_lvalue) {
try astgen.appendErrorTokNotes(s.token_src, "local variable is never mutated", .{}, &.{
try astgen.errNoteTok(s.token_src, "consider using 'const'", .{}),
});
// try astgen.appendErrorTokNotes(s.token_src, "local variable is never mutated", .{}, &.{
// try astgen.errNoteTok(s.token_src, "consider using 'const'", .{}),
// });
}
}

Expand Down

0 comments on commit f95826d

Please sign in to comment.