This is usually known as the identity function. It has the convenient property to guarantee not only collision resistance, but also the absence of any collision. However, it has the annoying property that finding prior images is slightly easier than one might expect, which could be considered a "weakness".
That said, its weakness depends on the security goals you want to achieve! There are many types of functions called hash functions, even in cryptography: universal hash families like Poly1305, stream ciphers like Salsa20, families of pseudo-random functions like SipHash, collision-resistant hashes like SHA3-256 , etc.