diff options
| -rw-r--r-- | engine/src/ui/view/world.rs | 13 | ||||
| -rw-r--r-- | rust-analyzer.json | 10 | ||||
| -rw-r--r-- | xtask/src/main.rs | 35 |
3 files changed, 43 insertions, 15 deletions
diff --git a/engine/src/ui/view/world.rs b/engine/src/ui/view/world.rs index ff4c13a..143ff84 100644 --- a/engine/src/ui/view/world.rs +++ b/engine/src/ui/view/world.rs @@ -608,7 +608,9 @@ fn enter_add_component_popup_state( .query::<(&ComponentInfo,)>() .iter_with_euids() .map(|(id, (component_info,))| { - let user_creatable = if component_info.type_reflection.is_none() { + let user_creatable = if component_info.is_sole { + ComponentUserCreatable::No { reason: "is a sole" } + } else if component_info.type_reflection.is_none() { ComponentUserCreatable::No { reason: "no type reflection" } } else if component_info .type_reflection @@ -796,10 +798,11 @@ fn show_add_component_popup( { actions.add_components( add_component_popup_state.target_entity_id, - [ComponentParts::builder() - .name(new_component_info.name) - .type_reflection(new_component_info.type_reflection) - .build_with_any_data(new_component_id, new_component_data)], + [ComponentParts::from_component_info( + &new_component_info, + new_component_id, + new_component_data, + )], ); return true; diff --git a/rust-analyzer.json b/rust-analyzer.json index f20ac7a..315e8fb 100644 --- a/rust-analyzer.json +++ b/rust-analyzer.json @@ -4,15 +4,7 @@ }, "check": { "overrideCommand": [ - "rustup", - "run", - "nightly", - "cargo", - "check", - "--workspace", - "--message-format=json", - "--keep-going", - "--config=.cargo/config-nightly-fast-compile.toml" + "cargo", "fcheck", "--workspace", "--message-format=json", "--keep-going" ] } } diff --git a/xtask/src/main.rs b/xtask/src/main.rs index e955925..8bf25ae 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -15,10 +15,43 @@ fn main() return; }; - if let Err(err) = Command::new(program).args(args).status() { + if let Err(err) = Command::new(program) + .args(args) + .remove_envs( + // When a binary crate is run with 'cargo run', cargo sets environment + // variables with information about the crate, package & cargo manifest. + // These environment variables are unwanted when the program run here + // is cargo so they are removed. + // + // If cargo is the program run here and the environment variables are + // kept, cargo does not overwrite them, which can cause unnecessary + // rebuilds of dependencies + std::env::vars() + .map(|(key, _)| key) + .filter(|key| key.starts_with("CARGO_") && key != "CARGO_HOME"), + ) + .status() + { println!("Error: Failed to execute command: {err}"); } } else { println!("Error: Unknown task '{task}'"); } } + +trait CommandExt +{ + fn remove_envs(&mut self, keys: impl IntoIterator<Item = String>) -> &mut Self; +} + +impl CommandExt for Command +{ + fn remove_envs(&mut self, keys: impl IntoIterator<Item = String>) -> &mut Self + { + for env_key in keys { + self.env_remove(env_key); + } + + self + } +} |
