mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 04:48:20 +00:00
zig fmt: remove c_void -> anyopaque rewrite
TODO comments said to remove this
This commit is contained in:
parent
8a27df5355
commit
d36cd49f0b
@ -106,29 +106,6 @@ test "zig fmt: rewrite callconv(.Inline) to the inline keyword" {
|
||||
);
|
||||
}
|
||||
|
||||
// TODO Remove this after zig 0.10.0 is released.
|
||||
test "zig fmt: rewrite c_void to anyopaque" {
|
||||
try testTransform(
|
||||
\\const Foo = struct {
|
||||
\\ c_void: *c_void,
|
||||
\\};
|
||||
\\
|
||||
\\fn foo(a: ?*c_void) !*c_void {
|
||||
\\ return a orelse unreachable;
|
||||
\\}
|
||||
\\
|
||||
,
|
||||
\\const Foo = struct {
|
||||
\\ c_void: *anyopaque,
|
||||
\\};
|
||||
\\
|
||||
\\fn foo(a: ?*anyopaque) !*anyopaque {
|
||||
\\ return a orelse unreachable;
|
||||
\\}
|
||||
\\
|
||||
);
|
||||
}
|
||||
|
||||
test "zig fmt: simple top level comptime block" {
|
||||
try testCanonical(
|
||||
\\// line comment
|
||||
|
||||
@ -207,18 +207,9 @@ fn renderExpression(gpa: Allocator, ais: *Ais, tree: Ast, node: Ast.Node.Index,
|
||||
const node_tags = tree.nodes.items(.tag);
|
||||
const datas = tree.nodes.items(.data);
|
||||
switch (node_tags[node]) {
|
||||
// TODO remove this c_void -> anyopaque rewrite after the 0.10.0 release.
|
||||
// Also get rid of renderSpace() as it will no longer be necessary.
|
||||
.identifier => {
|
||||
const token_index = main_tokens[node];
|
||||
|
||||
const lexeme = tokenSliceForRender(tree, token_index);
|
||||
if (mem.eql(u8, lexeme, "c_void")) {
|
||||
try ais.writer().writeAll("anyopaque");
|
||||
return renderSpace(ais, tree, token_index, lexeme.len, space);
|
||||
} else {
|
||||
return renderIdentifier(ais, tree, token_index, space, .preserve_when_shadowing);
|
||||
}
|
||||
return renderIdentifier(ais, tree, token_index, space, .preserve_when_shadowing);
|
||||
},
|
||||
|
||||
.number_literal,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user