mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 13:51:31 +00:00
Use assert_never properly
This commit is contained in:
parent
1f53026997
commit
a60168e674
1 changed files with 3 additions and 1 deletions
|
@ -398,7 +398,9 @@ impl Builder {
|
||||||
pub(crate) fn set_detail(mut self, detail: Option<impl Into<String>>) -> Builder {
|
pub(crate) fn set_detail(mut self, detail: Option<impl Into<String>>) -> Builder {
|
||||||
self.detail = detail.map(Into::into);
|
self.detail = detail.map(Into::into);
|
||||||
if let Some(detail) = &self.detail {
|
if let Some(detail) = &self.detail {
|
||||||
assert_never!(detail.contains('\n'), "multiline detail: {}", detail);
|
if assert_never!(detail.contains('\n'), "multiline detail: {}", detail) {
|
||||||
|
self.detail = Some(detail.splitn(2, '\n').next().unwrap().to_string());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue