Merge branch 'main' into stream-git-statuses
This commit is contained in:
commit
28ba27c9c5
206 changed files with 5946 additions and 3086 deletions
|
@ -21,6 +21,7 @@ isahc.workspace = true
|
|||
smol.workspace = true
|
||||
url = "2.2"
|
||||
rand.workspace = true
|
||||
rust-embed.workspace = true
|
||||
tempdir = { workspace = true, optional = true }
|
||||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
|
|
|
@ -15,6 +15,7 @@ lazy_static::lazy_static! {
|
|||
pub static ref LAST_USERNAME: PathBuf = CONFIG_DIR.join("last-username.txt");
|
||||
pub static ref LOG: PathBuf = LOGS_DIR.join("Zed.log");
|
||||
pub static ref OLD_LOG: PathBuf = LOGS_DIR.join("Zed.log.old");
|
||||
pub static ref LOCAL_SETTINGS_RELATIVE_PATH: &'static Path = Path::new(".zed/settings.json");
|
||||
}
|
||||
|
||||
pub mod legacy {
|
||||
|
|
|
@ -7,8 +7,10 @@ pub mod paths;
|
|||
pub mod test;
|
||||
|
||||
use std::{
|
||||
borrow::Cow,
|
||||
cmp::{self, Ordering},
|
||||
ops::{AddAssign, Range, RangeInclusive},
|
||||
panic::Location,
|
||||
pin::Pin,
|
||||
task::{Context, Poll},
|
||||
};
|
||||
|
@ -129,11 +131,13 @@ where
|
|||
{
|
||||
type Ok = T;
|
||||
|
||||
#[track_caller]
|
||||
fn log_err(self) -> Option<T> {
|
||||
match self {
|
||||
Ok(value) => Some(value),
|
||||
Err(error) => {
|
||||
log::error!("{:?}", error);
|
||||
let caller = Location::caller();
|
||||
log::error!("{}:{}: {:?}", caller.file(), caller.line(), error);
|
||||
None
|
||||
}
|
||||
}
|
||||
|
@ -281,6 +285,14 @@ impl<T: Rng> Iterator for RandomCharIter<T> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Get an embedded file as a string.
|
||||
pub fn asset_str<A: rust_embed::RustEmbed>(path: &str) -> Cow<'static, str> {
|
||||
match A::get(path).unwrap().data {
|
||||
Cow::Borrowed(bytes) => Cow::Borrowed(std::str::from_utf8(bytes).unwrap()),
|
||||
Cow::Owned(bytes) => Cow::Owned(String::from_utf8(bytes).unwrap()),
|
||||
}
|
||||
}
|
||||
|
||||
// copy unstable standard feature option unzip
|
||||
// https://github.com/rust-lang/rust/issues/87800
|
||||
// Remove when this ship in Rust 1.66 or 1.67
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue