Skip to content

Rewriting Old Dumb Code - #149

Merged
dipamsen merged 13 commits into
mainfrom
harsh/reduce-clones
Mar 14, 2026
Merged

dipamsen merged 13 commits into
mainfrom
harsh/reduce-clones

Conversation

@harshkhandeparkar

@harshkhandeparkar harshkhandeparkar commented Mar 8, 2026 •

Copy link
Copy Markdown
Member

Description

  • Reduced .clone(), .to_owned() etc. everywhere.
  • Replaced .iter() with .into_iter() to prevent cloning references like an idiot.
    • Returned iterators wherever possible to reduce collecting to vectors and immediately converting to iterators again.
  • Used references where cloning is not done or is only done partially.
  • Used owned values where the value was only used once instead of creating a reference and cloning.
  • Used &str types instead of &String.
  • Removed Clone, Copy derives from almost everything.
  • Convert state to an Arc instead of cloning it every time.
  • Replaced Status enum with just a String.
  • Removed unused code and unnecessary #[allow(unused)].
  • Implemented the sqlx::Type, sqlx::Decode and sqlx::Encode traits for the question paper types
    • Converting to an intermediate DBQuestionPaper type is no longer required. sqlx.query.as() can be directly used.
  • Overall, made old stupid code I had written slightly better.

@vercel

vercel Bot commented Mar 8, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
iqps Ready Ready Preview, Comment Mar 14, 2026 5:00am

@harshkhandeparkar harshkhandeparkar changed the title refactor: reduce clones throughout Rewriting Stupid Old Code Mar 9, 2026
@harshkhandeparkar harshkhandeparkar changed the title Rewriting Stupid Old Code Rewriting Old Dumb Code Mar 9, 2026
@dipamsen
dipamsen merged commit b7e0c0d into main Mar 14, 2026
3 checks passed
@dipamsen
dipamsen deleted the harsh/reduce-clones branch March 14, 2026 05:07

This branch was successfully deployed

1 active deployment
Preview — 68e6b590 Deployed Mar 14, 2026 by vercel[bot]
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