Improve type stability in Artifacts code (#52759)
This was in an attempt to fix
https://github.com/JuliaLang/julia/issues/52711 which ultimately proved
unsuccessful. This might however still be useful in other scenarios.
```
using JET
report_opt(Tuple{typeof(Artifacts._artifact_str), Module, String, Base.SubString{String}, String, Base.Dict{String, Any}, Base.SHA1, Base.BinaryPlatforms.Platform, Any}; target_modules=[Artifacts])
```
is quite a bit cleaner with this.