Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Check formatting
run: cargo fmt -- --check

- name: Lint
run: cargo clippy -- -D warnings
Comment thread
escapedcat marked this conversation as resolved.

- name: Run tests
run: cargo test --verbose

Expand Down
12 changes: 10 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,16 @@ cargo test get_empty_array
cargo test get_not_empty_array
```

### Git commits
Always run cargo fmt before commiting changes
### Pre-commit checklist
Always run these before committing:
```bash
cargo fmt # Format code
cargo clippy -- -D warnings # Lint (must pass with zero warnings)
cargo test # Run tests
```

### Rust version
The project pins its Rust version in `rust-toolchain.toml`. Rustup handles this automatically — no manual version management needed. The toolchain file also ensures `rustfmt` and `clippy` components are installed.

## Code Structure

Expand Down
1 change: 1 addition & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[toolchain]
channel = "1.93.0"
components = ["rustfmt", "clippy"]
6 changes: 4 additions & 2 deletions src/rest/v4/activity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ use actix_web::web::Query;
use regex::Regex;
use serde::Deserialize;
use serde::Serialize;
use std::sync::LazyLock;
use time::Duration;
use time::OffsetDateTime;

static TIP_RE: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"(lightning:[^)]+)").unwrap());

const EVENT_TYPE_CREATE: &str = "place_added";
const EVENT_TYPE_UPDATE: &str = "place_updated";
const EVENT_TYPE_DELETE: &str = "place_deleted";
Expand Down Expand Up @@ -83,8 +86,7 @@ pub async fn get(

let element_name = element.name(None);

let re = Regex::new(r"(lightning:[^)]+)").unwrap();
let user_tip = re
let user_tip = TIP_RE
.captures(&osm_user.osm_data.description)
.map(|c| c[1].to_string());

Expand Down
Loading