-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfix_specific.rs
More file actions
32 lines (26 loc) · 2.41 KB
/
Copy pathfix_specific.rs
File metadata and controls
32 lines (26 loc) · 2.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Fix the specific issues correctly
use std::fs;
use std::io::Write;
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Fix user-mode-service - only fix truly unused variables
let api_content = fs::read_to_string("C:\\Users\\nese1\\CascadeProjects\\windsurf-project-2\\user-mode-service\\src\\api_server.rs")?;
let fixed_api_content = api_content
// Fix only the functions that don't use the variables
// Keep server_selector in scan_servers function (line 715)
// Fix get_ranked_servers function (line 734) - both unused
.replace("State((service, server_selector)): State<(Arc<BunkerDnsService>, Arc<PoorManVpn>)>,\n) -> Result<Json<serde_json::Value>, StatusCode> {", "State((_service, _server_selector)): State<(Arc<BunkerDnsService>, Arc<PoorManVpn>)>,\n) -> Result<Json<serde_json::Value>, StatusCode> {")
// Fix export_servers function (line 750) - both unused
.replace("State((service, server_selector)): State<(Arc<BunkerDnsService>, Arc<PoorManVpn>)>,\n Query(params): Query<ExportParams>,", "State((_service, _server_selector)): State<(Arc<BunkerDnsService>, Arc<PoorManVpn>)>,\n Query(params): Query<ExportParams>,")
// Fix type annotation issue
.replace("ranked_servers.len()", "ranked_servers.len() as usize");
fs::write("C:\\Users\\nese1\\CascadeProjects\\windsurf-project-2\\user-mode-service\\src\\api_server.rs", fixed_api_content)?;
// Fix remaining example warnings
let smart_content = fs::read_to_string("C:\\Users\\nese1\\CascadeProjects\\windsurf-project-2\\poor-man-vpn\\examples\\smart_selector_demo.rs")?;
let fixed_smart_content = smart_content.replace(" PoorManVpn, SelectorConfig, LoadEstimate,", " PoorManVpn, SelectorConfig,");
fs::write("C:\\Users\\nese1\\CascadeProjects\\windsurf-project-2\\poor-man-vpn\\examples\\smart_selector_demo.rs", fixed_smart_content)?;
let whitelist_content = fs::read_to_string("C:\\Users\\nese1\\CascadeProjects\\windsurf-project-2\\poor-man-vpn\\examples\\windsurf_whitelist.rs")?;
let fixed_whitelist_content = whitelist_content.replace(" let mut config = YogaDnsCompatibility::default();", " let config = YogaDnsCompatibility::default();");
fs::write("C:\\Users\\nese1\\CascadeProjects\\windsurf-project-2\\poor-man-vpn\\examples\\windsurf_whitelist.rs", fixed_whitelist_content)?;
println!("Fixed specific warnings correctly");
Ok(())
}