The example you gave is very unlikely to be copyrightable. Copyright covers expression of ideas, not ideas themselves. However it would be courteous to put a thank you in a comment next to the line.
In terms of contributions in general, this will largely depend of several factors. The norm in open source is that the inbound license = the outbound license. However, this is more of a community standard rather than a legal stance (I don't think this implied license has been challenged in court). If you are hosting on GitHub, the GitHub ToS states that inbound = outbound is the explicit default. If you are hosting on BitBucket, the ToS requires you to specify an inbound license. I did not find anything in GitLab ToS, so you will need a CLA.
An additional point of consideration is the requirement to maintain copyright line in many licenses. If the contributor adds a copyright line, you need to store it somewhere. It is unclear what happens if the contributor does not specify a copyright line whatsoever. It would be preferable to leave copyright lines in the project root, so that users of your project do not have to search the source files to comply with the license when searching for a binary. Alternatively, your CLA can specify that you require contributors to agree that the copyright line "(c) xxx and contributors, xxxx" is sufficient, or that they waive the requirement to retain the copyright line.
I have just became aware that there are certain licenses that specify an inbound license. This should be a viable option as well. Such an example is the BSD-3-Clause-LBNL license, which states the following:
You are under no obligation whatsoever to provide any bug fixes,
patches, or upgrades to the features, functionality or performance of
the source code ("Enhancements") to anyone; however, if you choose to
make your Enhancements available either publicly, or directly to
Lawrence Berkeley National Laboratory, without imposing a separate
written license agreement for such Enhancements, then you hereby grant
the following license: a non-exclusive, royalty-free perpetual license
to install, use, modify, prepare derivative works, incorporate into
other computer software, distribute, and sublicense such Enhancements
or derivative works thereof, in binary and source code form.
This effectively asks for a public domain dedication from contributors.
Of course, you should change the reference to "Lawrence Berkeley National Laboratory" to something more sensible to your project.