Login
You're viewing the functional.cafe public feed.

Replies

  • Sep 28, 2026, 8:01 AM

    @bignose As a lint it's most useful for bigger project organizations. For a single dev it doesn't really matter. If you don't want unsafe, just don't write any.

    It's also configured for your own crate only and doesn't transitively apply down to your dependencies

    💬 2🔄 0⭐ 0
  • 💬 0🔄 0⭐ 0
  • Sep 28, 2026, 8:02 AM

    @diondokter
    > If you don't want unsafe, just don't write any.

    Well that's easy enough to say, but of course the reason I'm considering enabling it is for when I *don't know whether* I wrote unsafe code :-)

    > Turning it on doesn't risk anything either

    Thanks, that's helpful. Shall continue on with The Rust Book now.

    💬 1🔄 0⭐ 0
  • Sep 28, 2026, 8:03 AM

    @bignose Ah! Well unsafe code is only possible when using the `unsafe` keyword. So you'll know when you're writing it

    💬 1🔄 0⭐ 0
  • Sep 28, 2026, 8:05 AM

    @diondokter
    > only possible when using the `unsafe` keyword. So you'll know when you're writing it

    Oh, that explains it better. Okay, well I may turn it on to avoid temptation then!

    💬 0🔄 0⭐ 0
  • Sep 28, 2026, 8:04 AM

    @bignose as a beginner you will not use unsafe functions/blocks.

    There are some programs/constructs which cannot be verified by the compiler to be safe. In these cases the programmer needs to verify that all required conditions for being memory safe are upheld within the block marked as unsafe or before calling an unsafe function.

    💬 1🔄 0⭐ 0
  • Sep 28, 2026, 8:09 AM

    Gotcha @h4kor. I have seen that referenced in discussions, but had not yet got to the point of learning the `unsafe` keyword. Now I remember it's actually an explicit syntactical switch.

    This makes more sense, thank you.

    💬 0🔄 0⭐ 0
  • 💬 1🔄 0⭐ 0
  • Sep 28, 2026, 8:07 AM

    @GrandmasterBash
    > You can get pretty far without unsafe.

    Thanks. Okay, since I'm attracted specifically by the strict type safety, I reckon I'll set that linter to "forbid", as a prompt for me to always find the type-safe way of implementation

    knowing that `unsafe` is available later on for the few cases where it's better. Sound good?

    💬 1🔄 0⭐ 0
  • Sep 28, 2026, 8:14 AM

    @bignose unsafe enables a few Mechanisms in the language that are otherwise not possible. It enables features that could introduce undefined behavior if used wrong.

    So I would not forbid unsafe usage generally, because it might be nesscary depending ob your Domain (microcontrollers without unsafe might be not feasable) but I would keep them minimal and treat them extra careful.

    💬 0🔄 0⭐ 0