Apply cargo fmt to settings and attendance tests
Browse files at this commit9d57d6aa43500074b8ceb6c9079516f2fbfa5853Parent: caa814c- style
- apply cargo fmt to settings and attendance tests
2 changed files +13 -10
- src/domain/attendance.rs +3 -1
- src/domain/settings.rs +10 -9
src/domain/attendance.rsmodified+3 -1
| @@ -159,7 +159,9 @@ mod tests { | ||
| 159 | 159 | .to_vec(); |
| 160 | 160 | for status in ["present", "absent", "late", "excused"] { |
| 161 | 161 | assert_eq!( |
| 162 | - AttendanceStatus::try_new(status, &allowed).unwrap().as_str(), | |
| 162 | + AttendanceStatus::try_new(status, &allowed) | |
| 163 | + .unwrap() | |
| 164 | + .as_str(), | |
| 163 | 165 | status |
| 164 | 166 | ); |
| 165 | 167 | } |
src/domain/settings.rsmodified+10 -9
| @@ -176,10 +176,7 @@ impl Settings { | ||
| 176 | 176 | |
| 177 | 177 | /// Shared rules for the editable string lists: 1–20 trimmed, non-empty, |
| 178 | 178 | /// ≤50-char entries with no case-insensitive duplicates. |
| 179 | -fn validate_list( | |
| 180 | - field: &'static str, | |
| 181 | - values: Vec<String>, | |
| 182 | -) -> Result<Vec<String>, ValidationError> { | |
| 179 | +fn validate_list(field: &'static str, values: Vec<String>) -> Result<Vec<String>, ValidationError> { | |
| 183 | 180 | if values.is_empty() { |
| 184 | 181 | return Err(ValidationError::Empty(field)); |
| 185 | 182 | } |
| @@ -315,11 +312,15 @@ mod tests { | ||
| 315 | 312 | // Save a custom policy and read it back — bands (nested objects under |
| 316 | 313 | // a FLEXIBLE field) must survive the trip. |
| 317 | 314 | let statuses = Settings::defaults().get_attendance_statuses().to_vec(); |
| 318 | - Settings::try_new(kinds(&["lab"]), statuses.clone(), bands(&[(0, "F"), (50, "P")])) | |
| 319 | - .unwrap() | |
| 320 | - .save(&db) | |
| 321 | - .await | |
| 322 | - .unwrap(); | |
| 315 | + Settings::try_new( | |
| 316 | + kinds(&["lab"]), | |
| 317 | + statuses.clone(), | |
| 318 | + bands(&[(0, "F"), (50, "P")]), | |
| 319 | + ) | |
| 320 | + .unwrap() | |
| 321 | + .save(&db) | |
| 322 | + .await | |
| 323 | + .unwrap(); | |
| 323 | 324 | let loaded = Settings::load(&db).await.unwrap(); |
| 324 | 325 | assert_eq!(loaded.get_exam_kinds(), ["lab"]); |
| 325 | 326 | assert_eq!(loaded.get_grade_bands().len(), 2); |