# std.fmt: fix unecessary deref on user-defined format function · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/993a83081a975464d1201597cf6f4cb7f6735284)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 993a83081a975464d1201597cf6f4cb7f6735284

Requested commit: 993a83081a975464d1201597cf6f4cb7f6735284

Commit: 993a83081a975464d1201597cf6f4cb7f6735284

Tree: 08c07b7ad6c2d8b8e24d8e1ac2fe4ba1603b31ed

Author: Khang Nguyen Duy

Committer: Andrew Kelley

## Message

```
std.fmt: fix unecessary deref on user-defined format function

When formatting a pointer to user type, currently it needs to be
dereferenced first, then call `formatType` on the child type.

Fix the problem by checking for "format" function on not only the type
itself, but also the struct it points to. Add hasMethod to std.meta.

```

## Parents

- [aef1da1634ae12d90e9d59fc0184dadaea38830c](https://git.cafe/gitcafe/zig/commit/aef1da1634ae12d90e9d59fc0184dadaea38830c?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/993a83081a975464d1201597cf6f4cb7f6735284?format=markdown)
