Skip to content

ls: drop the dead code and the shadowed name - #202

Merged
JalonSolov merged 1 commit into
vlang:mainfrom
metif12:fix/ls-cleanup
Oct 4, 2026
Merged

JalonSolov merged 1 commit into
vlang:mainfrom
metif12:fix/ls-cleanup

Conversation

@metif12

@metif12 metif12 commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #201, from reading the notice list instead of filtering it.
Behaviour is unchanged.

  • natural_compare held its shared part count in a local called max. That is
    the same shadowing that made six helpers in format_long.v uncompilable once
    max came from a module instead of being a builtin, and it is called as a
    function two lines away. It is shared now.
  • The same function walked a three valued enum State to record one bit, so it
    is a bool now. Starting it false is what keeps a leading run of digits
    from emitting an empty first part, which is why the initial state was neither
    of the two real ones.
  • Its comment restated the function name. It now says what -v changes.
  • format_long.v had a local called checksum shadowing the checksum
    function, an unused statistics function that nothing called, and an unused
    options parameter on format_octal_permissions. Gone.
  • icons.v and table.v carried two unused constants and an unused border
    function. They are part of the non-GNU extras, but dead is dead, and four
    notices in every build helps nobody.

v fmt -verify . passes, v run build.vsh builds all 76, v test . reports 49
of 49, and src/ls now builds with no notices at all.

Follow-up to the previous commit, after reading the notice list rather than
filtering it. Behaviour is unchanged and the 49 case comparison against GNU is
still 39 of them.

- `natural_compare` held its shared part count in a local called `max`. That is
  the same shadowing that made six helpers in `format_long.v` uncompilable once
  `max` came from `math` instead of being a builtin, and it is called as a
  function two lines away. It is `shared` now.
- The same function walked a three valued `enum State` to record one bit, so it
  is a `bool` now. Starting it `false` is what keeps a leading run of digits
  from emitting an empty first part, which is why the initial state was neither
  of the two real ones.
- Its comment restated the function name. It now says what -v actually changes.
- `format_long.v` had a local called `checksum` shadowing the `checksum`
  function, an unused `statistics` function that nothing called, and an unused
  `options` parameter on `format_octal_permissions`. Gone.
- `icons.v` and `table.v` carried two unused constants and an unused border
  function. They were part of the extras, but dead is dead and leaving four
  notices in every build helps nobody.

`v fmt -verify .` passes, `v run build.vsh` builds all 76, `v test .` reports
49 of 49, and `src/ls` now builds with no notices at all.
@JalonSolov
JalonSolov merged commit 46fd6fc into vlang:main Oct 4, 2026
0 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants