Skip to content

chore: Refactor imports#107

Merged
Antiz96 merged 1 commit into
mainfrom
refactor_imports
Jul 6, 2026
Merged

chore: Refactor imports#107
Antiz96 merged 1 commit into
mainfrom
refactor_imports

Conversation

@Antiz96

@Antiz96 Antiz96 commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Description

Refactor imports and function calls to adopt a more concise yet still meaningful style.

General guidelines:

  • Import modules (using use ...) at the top.
  • When calling a function, keep module name when it provides useful context / provenance, e.g. env::var(), io::stdout(), fs::read_to_string().
  • If the function has an associated type, prefer using function name + type directly instead, e.g. ErrorKind::NotFound, HashMap::new(), PathBuf::from(), Uid::effective().

As a general rule of thumb, avoid deeply qualified paths and aim for roughly one :: per call (e.g. prefer ErrorKind::NotFound over std::io::ErrorKind::NotFound).

Exceptions can be made fine when it avoids ambiguity (such as conflicting functions names, e.g. std::thread::sleep vs tokio::time::sleep), or when a function call is already clear (from name or context) and the refactor doesn't bring much (for instance, the single get(&url) call from the current codebase).

Refactor imports and function calls to adopt a more concise yet still
meaningful style.

General guidelines:
- Import modules (using `use ...`) at the top.
- When calling a function, keep module name when it provides
  useful context / provenance, e.g.
  `env::var()`, `io::stdout()`, `fs::read_to_string()`.
- If the function has an associated type, prefer using function
  name + type directly instead, e.g.
  `ErrorKind::NotFound`, `HashMap::new()`, `PathBuf::from()`,
  `Uid::effective()`.

As a *general* rule of thumb, avoid deeply qualified paths and aim
for roughly one `::` per call (e.g. prefer `ErrorKind::NotFound` over
`std::io::ErrorKind::NotFound`).

Exceptions can be made fine when it avoids ambiguity (such as conflicting
functions names, e.g. `std::thread::sleep` vs `tokio::time::sleep`), or
when a function call is already clear (from name or context) and the
refactor doesn't bring much (for instance, the single `get(&url)` call
from the current codebase).
@Antiz96 Antiz96 added this to the v2.2.2 milestone Jul 6, 2026
@Antiz96 Antiz96 merged commit 0e925f4 into main Jul 6, 2026
1 check passed
@Antiz96 Antiz96 deleted the refactor_imports branch July 6, 2026 23:05
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.

1 participant