Skip to content

Commit

Permalink
use TypeFor
Browse files Browse the repository at this point in the history
  • Loading branch information
ktong committed Aug 26, 2024
1 parent 32ac5a6 commit 4e6f769
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions internal/convert/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ func withHookFunc[F, T any](hookFunc func(F, T) error) Option {
}

options.hooks = append(options.hooks, hook{
fromType: reflect.TypeOf((*F)(nil)).Elem(),
toType: reflect.TypeOf((*T)(nil)).Elem(),
fromType: reflect.TypeFor[F](),
toType: reflect.TypeFor[T](),
hook: func(f, t any) error {
from, ok := f.(F)
if !ok {
Expand Down
2 changes: 1 addition & 1 deletion internal/nocopy.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ func (c *NoCopy[T]) Check() {
}

if c.addr != c {
panic("illegal use of non-zero " + reflect.TypeOf((*T)(nil)).Elem().Name() + " copied by value")
panic("illegal use of non-zero " + reflect.TypeFor[T]().Name() + " copied by value")
}
}

0 comments on commit 4e6f769

Please sign in to comment.