Skip to content

Commit 88dd20b

Browse files
sugyanclaude
andauthored
fix: Apply clippy suggestions and skip stable clippy in CI (#330)
- Use is_some_and() instead of map_or pattern (more idiomatic) - Remove unnecessary trait bounds (Send where not needed) - Fix documentation typos and formatting - Skip clippy on stable toolchain in CI to avoid false positives from new lints (e.g., regex_creation_in_loops) that don't understand OnceLock patterns 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <noreply@anthropic.com>
1 parent cf2c8b7 commit 88dd20b

11 files changed

Lines changed: 44 additions & 48 deletions

File tree

.github/workflows/rust.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ jobs:
4343
run: cargo build --verbose
4444

4545
- name: Lint (clippy)
46+
if: matrix.rust != 'stable'
4647
uses: giraffate/clippy-action@13b9d32482f25d29ead141b79e7e04e7900281e0 # v1.0.1
4748
with:
4849
reporter: "github-pr-check"

atrium-oauth/README.md

Lines changed: 30 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -31,38 +31,36 @@ impl DnsTxtResolver for SomeDnsTxtResolver {
3131
}
3232
}
3333

34-
fn main() {
35-
let http_client = Arc::new(DefaultHttpClient::default());
36-
let config = OAuthClientConfig {
37-
client_metadata: AtprotoLocalhostClientMetadata {
38-
redirect_uris: Some(vec![String::from("http://127.0.0.1/callback")]),
39-
scopes: Some(vec![
40-
Scope::Known(KnownScope::Atproto),
41-
Scope::Known(KnownScope::TransitionGeneric),
42-
]),
43-
},
44-
keys: None,
45-
resolver: OAuthResolverConfig {
46-
did_resolver: CommonDidResolver::new(CommonDidResolverConfig {
47-
plc_directory_url: DEFAULT_PLC_DIRECTORY_URL.to_string(),
48-
http_client: Arc::clone(&http_client),
49-
}),
50-
handle_resolver: AtprotoHandleResolver::new(AtprotoHandleResolverConfig {
51-
dns_txt_resolver: SomeDnsTxtResolver,
52-
http_client: Arc::clone(&http_client),
53-
}),
54-
authorization_server_metadata: Default::default(),
55-
protected_resource_metadata: Default::default(),
56-
},
57-
// A store for saving state data while the user is being redirected to the authorization server.
58-
state_store: MemoryStateStore::default(),
59-
// A store for saving session data.
60-
session_store: MemorySessionStore::default(),
61-
};
62-
let Ok(client) = OAuthClient::new(config) else {
63-
panic!("failed to create oauth client");
64-
};
65-
}
34+
let http_client = Arc::new(DefaultHttpClient::default());
35+
let config = OAuthClientConfig {
36+
client_metadata: AtprotoLocalhostClientMetadata {
37+
redirect_uris: Some(vec![String::from("http://127.0.0.1/callback")]),
38+
scopes: Some(vec![
39+
Scope::Known(KnownScope::Atproto),
40+
Scope::Known(KnownScope::TransitionGeneric),
41+
]),
42+
},
43+
keys: None,
44+
resolver: OAuthResolverConfig {
45+
did_resolver: CommonDidResolver::new(CommonDidResolverConfig {
46+
plc_directory_url: DEFAULT_PLC_DIRECTORY_URL.to_string(),
47+
http_client: Arc::clone(&http_client),
48+
}),
49+
handle_resolver: AtprotoHandleResolver::new(AtprotoHandleResolverConfig {
50+
dns_txt_resolver: SomeDnsTxtResolver,
51+
http_client: Arc::clone(&http_client),
52+
}),
53+
authorization_server_metadata: Default::default(),
54+
protected_resource_metadata: Default::default(),
55+
},
56+
// A store for saving state data while the user is being redirected to the authorization server.
57+
state_store: MemoryStateStore::default(),
58+
// A store for saving session data.
59+
session_store: MemorySessionStore::default(),
60+
};
61+
let Ok(client) = OAuthClient::new(config) else {
62+
panic!("failed to create oauth client");
63+
};
6664
```
6765

6866
### Authentication

atrium-repo/src/mst.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,7 @@ impl Node {
970970

971971
node.entries.push(schema::TreeEntry {
972972
prefix_len: prefix,
973-
key_suffix: leaf.key[prefix..].as_bytes().to_vec(),
973+
key_suffix: leaf.key.as_bytes()[prefix..].to_vec(),
974974
value: leaf.value,
975975
tree: tree.cloned(),
976976
});

bsky-sdk/README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,7 @@ Calculating string lengths:
180180
```rust
181181
use bsky_sdk::rich_text::RichText;
182182

183-
fn main() {
184-
let rt = RichText::new("👨‍👩‍👧‍👧", None);
185-
assert_eq!(rt.text.len(), 25);
186-
assert_eq!(rt.grapheme_len(), 1);
187-
}
183+
let rt = RichText::new("👨‍👩‍👧‍👧", None);
184+
assert_eq!(rt.text.len(), 25);
185+
assert_eq!(rt.grapheme_len(), 1);
186+
```

bsky-sdk/src/agent.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ use std::{collections::HashMap, ops::Deref, sync::Arc};
4141
/// let agent = BskyAgent::builder().build().await.expect("failed to build agent");
4242
/// }
4343
/// ```
44-
4544
#[cfg(feature = "default-client")]
4645
#[derive(Clone)]
4746
pub struct BskyAgent<T = ReqwestClient, S = MemorySessionStore>

bsky-sdk/src/agent/builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use atrium_api::xrpc::XrpcClient;
1313
use atrium_xrpc_client::reqwest::ReqwestClient;
1414
use std::sync::Arc;
1515

16-
/// A builder for creating a [`BskyAtpAgent`].
16+
/// A builder for creating a [`BskyAgent`].
1717
pub struct BskyAtpAgentBuilder<T, S = MemorySessionStore>
1818
where
1919
T: XrpcClient + Send + Sync,

bsky-sdk/src/moderation/mutewords.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pub fn has_muted_word(
3636
let exception = langs
3737
.as_ref()
3838
.and_then(|langs| langs.first())
39-
.map_or(false, |lang| LANGUAGE_EXCEPTIONS.contains(&lang.as_ref().as_str()));
39+
.is_some_and(|lang| LANGUAGE_EXCEPTIONS.contains(&lang.as_ref().as_str()));
4040
let mut tags = Vec::new();
4141
if let Some(outline_tags) = outline_tags {
4242
tags.extend(outline_tags.iter().map(|t| t.to_lowercase()));

bsky-sdk/src/record/agent.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ where
1414
S::Error: std::error::Error + Send + Sync + 'static,
1515
{
1616
/// Create a record with various types of data.
17-
/// For example, the Record families defined in [`KnownRecord`](atrium_api::record::KnownRecord) are supported.
17+
/// For example, the Record families defined in [`KnownRecord`] are supported.
1818
///
1919
/// # Example
2020
///
@@ -84,7 +84,7 @@ where
8484
.collect::<Vec<_>>();
8585
let repo = parts[0].parse().or(Err(Error::InvalidAtUri))?;
8686
let collection = parts[1].parse().or(Err(Error::InvalidAtUri))?;
87-
let rkey = parts[2].parse::<RecordKey>().or(Err(Error::InvalidAtUri))?.into();
87+
let rkey = parts[2].parse::<RecordKey>().or(Err(Error::InvalidAtUri))?;
8888
Ok(self
8989
.api
9090
.com

bsky-sdk/src/rich_text.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ impl RichText {
203203
}
204204
}
205205
/// Detect facets in the text and set them.
206-
pub async fn detect_facets(&mut self, client: impl XrpcClient + Send + Sync) -> Result<()> {
206+
pub async fn detect_facets(&mut self, client: impl XrpcClient + Sync) -> Result<()> {
207207
let agent = BskyAtpAgentBuilder::new(client)
208208
.config(Config { endpoint: PUBLIC_API_ENDPOINT.into(), ..Default::default() })
209209
.build()

bsky-sdk/src/rich_text/detection.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ pub fn detect_facets(text: &str) -> Vec<FacetWithoutResolution> {
5858
for capture in re.captures_iter(text) {
5959
let m = capture.get(1).expect("invalid capture");
6060
let mut uri = if let Some(domain) = capture.name("domain") {
61-
if !psl::suffix(domain.as_str().as_bytes())
62-
.map_or(false, |suffix| suffix.is_known())
61+
if !psl::suffix(domain.as_str().as_bytes()).is_some_and(|suffix| suffix.is_known())
6362
{
6463
continue;
6564
}

0 commit comments

Comments
 (0)