summaryrefslogtreecommitdiffstats
path: root/src/tools/cargo/crates/crates-io
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/cargo/crates/crates-io')
-rw-r--r--src/tools/cargo/crates/crates-io/Cargo.toml5
-rw-r--r--src/tools/cargo/crates/crates-io/lib.rs11
2 files changed, 11 insertions, 5 deletions
diff --git a/src/tools/cargo/crates/crates-io/Cargo.toml b/src/tools/cargo/crates/crates-io/Cargo.toml
index f1b92602e..bf2b20cf7 100644
--- a/src/tools/cargo/crates/crates-io/Cargo.toml
+++ b/src/tools/cargo/crates/crates-io/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "crates-io"
-version = "0.39.1"
+version = "0.39.2"
rust-version.workspace = true
edition.workspace = true
license.workspace = true
@@ -20,3 +20,6 @@ serde = { workspace = true, features = ["derive"] }
serde_json.workspace = true
thiserror.workspace = true
url.workspace = true
+
+[lints]
+workspace = true
diff --git a/src/tools/cargo/crates/crates-io/lib.rs b/src/tools/cargo/crates/crates-io/lib.rs
index 1764ce527..468900e55 100644
--- a/src/tools/cargo/crates/crates-io/lib.rs
+++ b/src/tools/cargo/crates/crates-io/lib.rs
@@ -1,5 +1,3 @@
-#![allow(clippy::all)]
-
use std::collections::BTreeMap;
use std::fs::File;
use std::io::prelude::*;
@@ -438,7 +436,8 @@ impl Registry {
.map(|s| s.errors.into_iter().map(|s| s.detail).collect::<Vec<_>>());
match (self.handle.response_code()?, errors) {
- (0, None) | (200, None) => Ok(body),
+ (0, None) => Ok(body),
+ (code, None) if is_success(code) => Ok(body),
(code, Some(errors)) => Err(Error::Api {
code,
headers,
@@ -453,8 +452,12 @@ impl Registry {
}
}
+fn is_success(code: u32) -> bool {
+ code >= 200 && code < 300
+}
+
fn status(code: u32) -> String {
- if code == 200 {
+ if is_success(code) {
String::new()
} else {
let reason = reason(code);