mirror of
https://github.com/storytold/wordcraft.git
synced 2026-10-30 05:17:25 -06:00
Merge pull request #4376 from storytold/sonar/newcode-lints-1
Sonar: clear S1612, S2208 and S7688 new-code issues
This commit is contained in:
@@ -6,7 +6,10 @@
|
||||
//! whose walk is the document model's, is timed.
|
||||
|
||||
use super::tests::{SCALE, cost_ratio};
|
||||
use super::*;
|
||||
use super::{
|
||||
Block, CharProps, DocLayout, Document, HeaderSet, HeightRule, InlineObject, LayoutCache, LayoutOptions, ParaLayout, Paragraph, Path, Placed,
|
||||
SectionProps, SectionStart, StoryRef, display, layout, para, work,
|
||||
};
|
||||
use wordcraft_doc::para::Run;
|
||||
use wordcraft_doc::{Pos, Table};
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! A no-break space is laid out as wide as an ordinary space, whatever the font's own U+00A0
|
||||
//! glyph measures (Lucida Bright draws it twice as wide).
|
||||
|
||||
use super::*;
|
||||
use super::{Document, LayoutCache, LayoutOptions, Placed, layout};
|
||||
|
||||
/// Inter with its U+00A0 glyph twice as wide as its space, under the family name "Wnbsp".
|
||||
/// Built from the bundled font so the test needs no installed font.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! #3977: floating tables include a line's bottom edge; shapes keep a strict boundary.
|
||||
//! The expected distinction is cyril265's Word for Mac 16.114.1 observation in the issue.
|
||||
|
||||
use super::*;
|
||||
use super::{Arc, Block, Document, LayoutCache, LayoutOptions, Placed, StoryRef, layout};
|
||||
use wordcraft_doc::para::{Anchor, Float, InlineObject, ShapeKind, Wrap};
|
||||
use wordcraft_doc::props::{HeightRule, LineSpacing, ParaProps, TableFloat};
|
||||
use wordcraft_doc::{CharProps, Paragraph, Pos, Table};
|
||||
|
||||
@@ -16,7 +16,7 @@ mod suggest;
|
||||
pub(crate) mod test_dict;
|
||||
pub mod voseo;
|
||||
|
||||
use std::sync::{Arc, RwLock};
|
||||
use std::sync::{Arc, PoisonError, RwLock};
|
||||
|
||||
use crate::ProofLang;
|
||||
use crate::affix::AffixDict;
|
||||
@@ -62,11 +62,11 @@ pub fn dictionary_name(lang: ProofLang) -> &'static str {
|
||||
/// see [`has_dictionary`]).
|
||||
pub fn dictionary(lang: ProofLang) -> Arc<AffixDict> {
|
||||
let Some(slot) = DICTS.get(variety(lang).0) else { return Arc::new(AffixDict::default()) };
|
||||
if let Some(d) = slot.read().unwrap_or_else(|e| e.into_inner()).as_ref() {
|
||||
if let Some(d) = slot.read().unwrap_or_else(PoisonError::into_inner).as_ref() {
|
||||
return d.clone();
|
||||
}
|
||||
let loaded = Arc::new(load_installed(lang));
|
||||
let mut slot = slot.write().unwrap_or_else(|e| e.into_inner());
|
||||
let mut slot = slot.write().unwrap_or_else(PoisonError::into_inner);
|
||||
// Another thread (or an install) may have filled it meanwhile: that one wins.
|
||||
slot.get_or_insert(loaded).clone()
|
||||
}
|
||||
@@ -90,7 +90,7 @@ fn load_installed(lang: ProofLang) -> AffixDict {
|
||||
pub fn install_dictionary(lang: ProofLang, aff: &str, dic: &str) -> Result<(), String> {
|
||||
let d = AffixDict::from_hunspell(aff, dic, &[])?;
|
||||
if let Some(slot) = DICTS.get(variety(lang).0) {
|
||||
*slot.write().unwrap_or_else(|e| e.into_inner()) = Some(Arc::new(d));
|
||||
*slot.write().unwrap_or_else(PoisonError::into_inner) = Some(Arc::new(d));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
@@ -99,7 +99,7 @@ pub fn install_dictionary(lang: ProofLang, aff: &str, dic: &str) -> Result<(), S
|
||||
/// (after [`crate::hunspell::set_dictionary_dir`] or a dictionary was installed).
|
||||
pub fn reload_dictionary() {
|
||||
for slot in &DICTS {
|
||||
*slot.write().unwrap_or_else(|e| e.into_inner()) = None;
|
||||
*slot.write().unwrap_or_else(PoisonError::into_inner) = None;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ KEYCHAIN="$WORK/wordcraft-signing.keychain-db"
|
||||
cleanup() {
|
||||
local status=$?
|
||||
rm -f "$CERT"
|
||||
if [ "$status" -ne 0 ]; then
|
||||
if [[ "$status" -ne 0 ]]; then
|
||||
security delete-keychain "$KEYCHAIN" 2>/dev/null || true
|
||||
rm -rf "$WORK"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user