-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Each function uses T: ToString as a trait bound for its parameter, which is more general than needed and can lead to unexpected behavior or performance issues. Most likely, these functions are only intended to work with string-like types, such as &str or String.
Using impl Into instead of T: ToString is often preferred for constructors expecting ownership because it is more idiomatic and flexible in Rust, especially for APIs consuming strings. Alternatively, using &str directly could avoid unnecessary allocations if ownership isn't required.
For example, change:
pub fn column<T: ToString>(name: T) -> Column {
to:
pub fn column(name: impl Into) -> Column {
This change improves readability, idiomatic usage, and type inference without sacrificing flexibility.