Skip to content

Commit e49b34d

Browse files
chore(compiler): explicitly use IndexMap::{swap,shift}_remove (#817)
The indexmap crate has deprecated the `::remove` method. I think `shift_remove()` is the correct one to use in both cases: we want to maintain order even for orphan type extensions.
1 parent 8b1b391 commit e49b34d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

crates/apollo-compiler/examples/rename.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ fn renamed() -> Valid<Schema> {
1515
let mut schema = Schema::parse(input, "schema.graphql").unwrap();
1616

1717
// 1. Remove the definition from the `types` map, using its old name as a key
18-
let mut type_def = schema.types.remove("Query").unwrap();
18+
let mut type_def = schema.types.shift_remove("Query").unwrap();
1919

2020
// 2. Set the new name in the struct
2121
let ExtendedType::Object(obj) = &mut type_def else {

crates/apollo-compiler/src/schema/from_ast.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ impl SchemaBuilder {
116116
&mut self.errors,
117117
$def,
118118
self.orphan_type_extensions
119-
.remove(&$def.name)
119+
.shift_remove(&$def.name)
120120
.unwrap_or_default(),
121121
);
122122
entry.insert(extended_def.into());

0 commit comments

Comments
 (0)