• calcopiritus@lemmy.world
    link
    fedilink
    arrow-up
    2
    ·
    7 months ago

    Well, of course you can have few indent levels by just not indenting, I don’t think the readability loss is worth it though. If I had give up some indentation, I’d probably not indent the impl {} blocks.

    • Doods@infosec.pub
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      6 months ago

      I just got some idea yesterday regarding impl blocks, ready to be my respondent?

      I had a big impl block with 4 levels of indentation, so I cut the block, and replaced

      impl InputList {
          //snip
      }
      

      with mod impl_inputlist; and moved the impl block to a new file, and did not indent anything inside that block.

      The advantage this has over just not indenting the impl block in place, is that people will have difficulty distinguishing between what’s in the block and what’s outside, and that’s why the impl was moved to its own exclusive file, impl_inputlist.rs

      Maybe I am overstressing indentation. Ss there something wrong with my setup that prevents me from accepting 4-space indentation?

      I use:

      Editor: Neovide

      Font: “FiraCode Nerd Font Mono:h16” (16px fonts are addicintg)

      Monitor: 1366x768, 18.5 inch, 10+ years old, frankenstein-ly repaired Samsung monitor.

      Distance: I sit at about 40-60 Cm from my monitor.

      That leaves me with a 32x99 view of code excluding line numbers and such.