Skip to content

Commit

Permalink
Copy -> MyCopy
Browse files Browse the repository at this point in the history
  • Loading branch information
Medowhill committed Aug 2, 2024
1 parent e01b5ce commit 657e5d4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1143,7 +1143,7 @@ pub fn resolve_free_consts(code: &str, quiet: bool) -> Option<String> {
pub fn resolve_free_types(code: &str, prefix: &str, quiet: bool) -> Option<String> {
let full_code = format!("{}{}", prefix, code);
let config = make_config(&full_code);
let suggestions: Vec<_> = run_compiler(config, |compiler| {
let mut suggestions: Vec<_> = run_compiler(config, |compiler| {
compiler.enter(|queries| {
queries.global_ctxt().ok()?.enter(|tcx| {
let mut visitor = FreeTypeVisitor::new(tcx);
Expand Down Expand Up @@ -1204,6 +1204,7 @@ pub fn resolve_free_types(code: &str, prefix: &str, quiet: bool) -> Option<Strin
})
})
})??;
suggestions.retain(|s| !s.snippets.iter().any(|s| s.range.start == 0));
let full_code = rustfix::apply_suggestions(&full_code, &suggestions).expect(&full_code);
Some(full_code.strip_prefix(prefix).unwrap().to_string())
}
Expand Down
1 change: 1 addition & 0 deletions src/translation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1067,6 +1067,7 @@ impl<'ast> Translator<'ast> {
let mut new_name = match new_name.as_str() {
"Option" => "MyOption",
"Box" => "MyBox",
"Copy" => "MyCopy",
"Cmatrix" => "Matrix",
"Crec" => "Rec",
"Crecid" => "RecId",
Expand Down

0 comments on commit 657e5d4

Please sign in to comment.