Use read() over read_with() to improve readability in simple cases (#31263)

Release Notes:

- N/A
This commit is contained in:
Joseph T. Lyons 2025-05-23 08:08:49 -04:00 committed by GitHub
parent e88cad29e5
commit 6206150e27
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 11 additions and 18 deletions

View file

@ -153,13 +153,10 @@ impl Render for ProfileSelector {
.map(|profile| profile.name.clone())
.unwrap_or_else(|| "Unknown".into());
let configured_model = self
.thread
.read_with(cx, |thread, _cx| thread.configured_model())
.or_else(|| {
let model_registry = LanguageModelRegistry::read_global(cx);
model_registry.default_model()
});
let configured_model = self.thread.read(cx).configured_model().or_else(|| {
let model_registry = LanguageModelRegistry::read_global(cx);
model_registry.default_model()
});
let supports_tools =
configured_model.map_or(false, |default| default.model.supports_tools());