|
1 | | -use anyhow::{anyhow, Context}; |
| 1 | +use anyhow::{Context, anyhow}; |
2 | 2 | use ipnetwork::IpNetwork; |
3 | 3 | use oauth2::{ClientId, ClientSecret}; |
4 | 4 | use url::Url; |
5 | 5 |
|
6 | | -use crate::rate_limiter::{LimitedAction, RateLimiterConfig}; |
7 | 6 | use crate::Env; |
| 7 | +use crate::rate_limiter::{LimitedAction, RateLimiterConfig}; |
8 | 8 |
|
9 | 9 | use super::base::Base; |
10 | 10 | use super::database_pools::DatabasePools; |
11 | | -use crate::config::cdn_log_storage::CdnLogStorageConfig; |
12 | 11 | use crate::config::CdnLogQueueConfig; |
| 12 | +use crate::config::cdn_log_storage::CdnLogStorageConfig; |
13 | 13 | use crate::middleware::cargo_compat::StatusCodeConfig; |
14 | 14 | use crate::storage::StorageConfig; |
15 | 15 | use crates_io_env_vars::{list, list_parsed, required_var, var, var_parsed}; |
@@ -179,7 +179,11 @@ impl Server { |
179 | 179 | font-src https://code.cdn.mozilla.net; \ |
180 | 180 | img-src *; \ |
181 | 181 | object-src 'none'", |
182 | | - cdn_domain = storage.cdn_prefix.as_ref().map(|cdn_prefix| format!("https://{cdn_prefix}")).unwrap_or_default() |
| 182 | + cdn_domain = storage |
| 183 | + .cdn_prefix |
| 184 | + .as_ref() |
| 185 | + .map(|cdn_prefix| format!("https://{cdn_prefix}")) |
| 186 | + .unwrap_or_default() |
183 | 187 | ); |
184 | 188 |
|
185 | 189 | Ok(Server { |
@@ -259,7 +263,9 @@ fn parse_cidr_block(block: &str) -> anyhow::Result<IpNetwork> { |
259 | 263 | }; |
260 | 264 |
|
261 | 265 | if cidr.prefix() < host_prefix { |
262 | | - return Err(anyhow!("WEB_PAGE_OFFSET_CIDR_BLOCKLIST only allows CIDR blocks with a host prefix of at least 16 bits (IPv4) or 64 bits (IPv6).")); |
| 266 | + return Err(anyhow!( |
| 267 | + "WEB_PAGE_OFFSET_CIDR_BLOCKLIST only allows CIDR blocks with a host prefix of at least 16 bits (IPv4) or 64 bits (IPv6)." |
| 268 | + )); |
263 | 269 | } |
264 | 270 |
|
265 | 271 | Ok(cidr) |
|
0 commit comments