24 Pull Requests
rust-lang

rust-lang/crates.io

The Rust package registry
Rust
View on GitHub https://crates.io
bug
design
feature
documentation
tests
help-wanted
enhancement
Contribulator score: 33 Last scored 2023-11-07 18:31:11 UTC
Contributors (5)
  • BlakeWilliams
  • carols10cents
  • DoumanAsh
  • pimterry
  • Turbo87

Pull requests (208)

Turbo87

bin/server: Use `anyhow` instead of `AppResult` to rust-lang/crates.io 2023-12-18 10:18:58 UTC

We're only logging the error, but not transforming it into an HTTP response, so there is no need for using the custom AppResult type.

Turbo87

models: Use `QueryResult` instead of `AppResult` where possible to rust-lang/crates.io 2023-12-16 23:54:45 UTC

AppResult is something from the HTTP/API layer and the models modules shouldn't know anything about that. This PR reduces the coupling a little bit by replacing AppResult with QueryResult where possible.

Turbo87

controllers/github/secret_scanning: Replace `Result<_, BoxedAppError>` with `QueryResult<_>` to rust-lang/crates.io 2023-12-16 22:23:00 UTC

There is no need to use BoxedAppError if the only error returned from a function is a diesel error.

Turbo87

email: Use `Transport` implementations in all backend variants to rust-lang/crates.io 2023-12-16 21:17:27 UTC

Previously we were creating these Transport instances per email that we send, but that seems a bit unnecessary. Creating them once on server startup allows us to fail early for configuration issues.

Our in-memory implementation was …

Turbo87

email: Add `from` field to `Emails` struct to rust-lang/crates.io 2023-12-16 21:06:30 UTC

This allows us to fail early if the value can't be parsed into a Mailbox

Turbo87

email: Change default "From" address to "[email protected]" to rust-lang/crates.io 2023-12-16 20:16:03 UTC

This is what we use in production so we may as well use it in tests too

Turbo87

controllers/github/secret_scanning: Only obtain database connection once per request to rust-lang/crates.io 2023-12-15 15:48:04 UTC

Getting a new connection for every loop iteration seems a bit wasteful…

Turbo87

Simplify `metrics` controller to rust-lang/crates.io 2023-12-15 15:44:35 UTC

see commit messages 😉

Turbo87

email: Add `domain` field to rust-lang/crates.io 2023-12-15 15:41:48 UTC

Instead of calling dotenvy::var(&quot;DOMAIN_NAME&quot;) over and over we can read the value from the server config struct and save it inside the Emails instance 🎉

Turbo87

email: Extract `EmailError` enum to rust-lang/crates.io 2023-12-15 14:35:12 UTC

This removes the tight coupling between the HTTP/API layer with its AppResult struct and the email module, which should not know anything about HTTP or our API.

Turbo87

controllers/github/secret_scanning: Simplify `PUBLIC_KEY_CACHE_LIFETIME` usage to rust-lang/crates.io 2023-12-15 14:32:58 UTC

This PR converts static PUBLIC_KEY_CACHE_LIFETIME_SECONDS: i64 to const PUBLIC_KEY_CACHE_LIFETIME: Duration since most of the work can already be performed at compile time.

Turbo87

Extract `find_by_login()` fns to rust-lang/crates.io 2023-12-15 11:02:18 UTC

This reduces some of the verbose code in the models/owner module a bit.

Turbo87

models/owner: Simplify `Owner` fns to rust-lang/crates.io 2023-12-15 09:38:29 UTC

🤷‍♂️

Turbo87

Fix error handling for optional SQL results to rust-lang/crates.io 2023-12-15 09:36:59 UTC

When diesel returns an error it doesn't always mean that the resource couldn't be found, it could also be any other kind of error. A couple of places in the codebase were unconditionally transforming diesel errors into "could not fin…

Turbo87

Extract `crates_io_github` package to rust-lang/crates.io 2023-12-14 18:41:43 UTC

This PR extracts our top-level github module into a dedicated workspace package. This makes it easier to enforce the decoupling between the GitHub client code and our HTTP API layer.

Turbo87

github: Use `Bearer` authorization scheme instead of `token` to rust-lang/crates.io 2023-12-14 13:54:43 UTC

Bearer is the official standard scheme (see https://www.iana.org/assignments/http-authschemes/http-authschemes.xhtml), while token is a GitHub-specific variant. According to https://docs.github.com/de/rest/authentication/authenticati…

Turbo87

github: Extract `GitHubError` enum to rust-lang/crates.io 2023-12-14 13:20:09 UTC

This reduces the need for e.is::&lt;NotFound&gt;() checks and makes the code a little less coupled to our HTTP layer and its error responses.

Turbo87

auth: Simplify `ensure_not_locked()` fn to rust-lang/crates.io 2023-12-14 11:31:37 UTC

This seems slightly easier on the eyes compared to the let-if-let-else construct before.

Turbo87

worker/tests: Use `TestDatabase::connect()` for DB interactions to rust-lang/crates.io 2023-12-14 10:57:02 UTC

The Runner should not unnecessarily share its connections with anything on the outside, so instead of using the Runner::connection() fn this PR replaces it with TestDatabase::connect(), which uses the connection pool inside the `Te…

Turbo87

worker: Enable missing `tokio` feature to rust-lang/crates.io 2023-12-14 10:46:56 UTC

This fixes the following issue:

$ cargo test --package crates_io_worker

error[E0432]: unresolved import `tokio::time`
  --&gt; crates_io_worker/src/worker.rs:13:12
   |
13 | use tokio::time::sleep;
   |            ^^^^ could ...
Turbo87

util/errors/json: Move structs closer to their impl blocks to rust-lang/crates.io 2023-12-14 10:09:42 UTC

This has confused me too many times, so now it will be fixed :D

Having a short list of all the structs is surely nice, but if it then becomes complicated to find their impl blocks it's just not worth it, especially if not all the stru…

Turbo87

router: Move tests to `util/errors` module to rust-lang/crates.io 2023-12-14 09:55:55 UTC

These tests don't appear to be related to our routing code at all, so this commit moves them into the module where most of the tested code comes from.

Turbo87

Clippy: Enable `dbg!()` warnings to rust-lang/crates.io 2023-12-13 21:20:33 UTC

Addresses https://github.com/rust-lang/crates.io/pull/7715#discussion_r1425878876 😅

Turbo87

Ensure `200 OK` status codes for cargo endpoints to rust-lang/crates.io 2023-12-13 20:56:52 UTC

cargo before 1.34.0 only showed raw JSON errors when a non-200 status code was returned. In crates.io we are using the cargo_err() fn in many places to ensure that the error that is returned uses the 200 OK status code. As can be see…

Turbo87

bin/server: Improve router wrapping comment with docs URL to rust-lang/crates.io 2023-12-13 16:07:38 UTC

« First ‹ Prev 1 2 3 4 5 6 7 … Next › Last »
  • Sponsored by  DNSimple,  Octobox &  Bugsnag
  • About
  • How to contribute?
  • API
  • Unsubscribe
    •  English
    •  Español
    •  Ελληνικά
    •  Português do Brasil
    •  Suomi
    •  Français
    •  Deutsch
    •  Русский
    •  Українська
    •  ไทย
    •  Italiano
    •  Norsk bokmål
    •  தமிழ்
    •  Tr
    •  简体中文
    •  正體中文
    •  日本語
    •  Čeština
    •  हिंदी
    •  Polski
    • Translate into your language!