Open ubeing opened 3 days ago
rust-analyzer version: V0.3.2188
rustc version: 1.81.9
editor or extension: VSCode on macOS
code snippet to reproduce:
pub async fn new_course( new_course: web::Json<Course>, app_state: web::Data<AppState>, ) -> HttpResponse { let course_count = app_state .courses .lock() .unwrap() .clone() .into_iter() .filter(|course| course.teacher_id == new_course.teacher_id) .collect::<Vec<Course>>() .len(); let new_course = Course { teacher_id: new_course.teacher_id, id: Some(course_count + 1), name: new_course.name.clone(), time: Some(Utc::now().naive_utc()), }; app_state.courses.lock().unwrap().push(new_course); HttpResponse::Ok().json("Course added") }
The IDE always issues an unused variable warning for the variable 'coursecount', even if you prefix the variable with ''
Which crates are you using there?
FWIW, I don't get any warning. And you're unnecessarily cloning courses there.
courses
rust-analyzer version: V0.3.2188
rustc version: 1.81.9
editor or extension: VSCode on macOS
code snippet to reproduce:
The IDE always issues an unused variable warning for the variable 'coursecount', even if you prefix the variable with ''