Fix rustfmt by pulling out long string into constant

This commit is contained in:
Thorsten Ball 2024-01-16 16:51:08 +01:00
parent 1cbdf2ba22
commit 62f5becf1f

View file

@ -282,6 +282,8 @@ impl EventEmitter<ViewEvent> for ProjectSearchView {}
impl Render for ProjectSearchView { impl Render for ProjectSearchView {
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement { fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
const PLEASE_AUTHENTICATE: &str = "API Key Missing: Please set 'OPENAI_API_KEY' in Environment Variables. If you authenticated using the Assistant Panel, please restart Zed to Authenticate.";
if self.has_matches() { if self.has_matches() {
div() div()
.flex_1() .flex_1()
@ -307,8 +309,7 @@ impl Render for ProjectSearchView {
SemanticIndexStatus::NotAuthenticated => { SemanticIndexStatus::NotAuthenticated => {
major_text = Label::new("Not Authenticated"); major_text = Label::new("Not Authenticated");
show_minor_text = false; show_minor_text = false;
Some( Some(PLEASE_AUTHENTICATE.to_string())
"API Key Missing: Please set 'OPENAI_API_KEY' in Environment Variables. If you authenticated using the Assistant Panel, please restart Zed to Authenticate.".to_string())
} }
SemanticIndexStatus::Indexed => Some("Indexing complete".to_string()), SemanticIndexStatus::Indexed => Some("Indexing complete".to_string()),
SemanticIndexStatus::Indexing { SemanticIndexStatus::Indexing {