Bowyerhub
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
cm0002@lemmy.world to Programmer Humor@programming.dev · 4 months ago

What's stopping you from writing your Rust like this?

message-square
17
fedilink
  • cross-posted to:
  • programmerhumor@lemmy.ml
6

What's stopping you from writing your Rust like this?

cm0002@lemmy.world to Programmer Humor@programming.dev · 4 months ago
message-square
17
fedilink
  • cross-posted to:
  • programmerhumor@lemmy.ml
alert-triangle
You must log in or register to comment.
  • Dave.@aussie.zone
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    4 months ago

    rustfmt

    is stopping me from writing code like this, and I have never been more happier using it after viewing this.

    • killeronthecorner@lemmy.world
      link
      fedilink
      English
      arrow-up
      1
      ·
      4 months ago

      I’m going to write a tool that automatically adds the braces and semicolons to the column as you edit the code.

      I will call it rustfml

      • irelephant [he/him]🍭@lemm.ee
        link
        fedilink
        English
        arrow-up
        1
        ·
        4 months ago

        Crap, thats what I was thinking.

        • verstra@programming.dev
          link
          fedilink
          arrow-up
          1
          ·
          4 months ago

          It could be run after git checkout and then rustfmt before commit.

  • TheAgeOfSuperboredom@lemmy.ca
    link
    fedilink
    arrow-up
    2
    ·
    4 months ago

    Then some jerk runs rustfmt and ruins all your hard work!

    • wise_pancake@lemmy.ca
      link
      fedilink
      arrow-up
      1
      ·
      4 months ago

      Can’t you fix the default format to this?

  • duckythescientist@sh.itjust.works
    link
    fedilink
    arrow-up
    2
    ·
    4 months ago

    I’m good at Python, and I don’t know Rust. This looks fine to me. I’ve fully missed the joke.

    • Logi@lemmy.world
      link
      fedilink
      arrow-up
      2
      ·
      edit-2
      4 months ago

      Same. Until you notice the column of curly braces and semi colons in the right margin.

      • ryannathans@aussie.zone
        link
        fedilink
        arrow-up
        2
        ·
        4 months ago

        Lgtm ship it to prod

  • CanadaPlus@lemmy.sdf.org
    link
    fedilink
    arrow-up
    2
    ·
    4 months ago

    Wow, so this is possible.

    Formatting is so damn arbitrary. Somebody has to have tried storing just the parse tree on disk, right?

  • Laser@feddit.org
    link
    fedilink
    arrow-up
    1
    ·
    4 months ago

    • enemenemu@lemm.ee
      link
      fedilink
      arrow-up
      1
      ·
      4 months ago

      To me it just looks like you do not need the braces at all

    • merc@sh.itjust.works
      link
      fedilink
      arrow-up
      1
      ·
      4 months ago

      A funny, but incredibly subtle joke to do would be to do a post like this, but get the indentation subtly wrong somewhere, so something that’s supposed to be inside a loop is outside according to indentation, but is inside according to braces.

  • notabot@lemm.ee
    link
    fedilink
    arrow-up
    1
    ·
    4 months ago

    This makes my deeply uncomfortable, like an itch I can’t quite scratch.

  • parlaptie@feddit.org
    link
    fedilink
    arrow-up
    1
    ·
    4 months ago

    Hang on, this is just a C++ joke slapped onto Rust.

    • puchaczyk@lemmy.blahaj.zone
      link
      fedilink
      arrow-up
      1
      ·
      4 months ago

      You could say they have rewritten the joke in Rust

      • dave@feddit.uk
        link
        fedilink
        English
        arrow-up
        1
        ·
        4 months ago

        But you get the joke faster now.

Programmer Humor@programming.dev

programmer_humor@programming.dev

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !programmer_humor@programming.dev

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

  • Keep content in english
  • No advertisements
  • Posts must be related to programming or programmer topics
Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 296 users / day
  • 3.74K users / week
  • 8.92K users / month
  • 16.8K users / 6 months
  • 1 local subscriber
  • 24.7K subscribers
  • 844 Posts
  • 13.4K Comments
  • Modlog
  • mods:
  • adr1an@programming.dev
  • Feyter@programming.dev
  • BurningTurtle@programming.dev
  • Pierre-Yves Lapersonne@programming.dev
  • BE: 0.19.9
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org