mirror of
https://github.com/tealdeer-rs/tealdeer.git
synced 2026-08-23 08:34:18 +02:00
Bump edition to 2024 (#510)
This commit is contained in:
parent
82b9c88f39
commit
5f837f4dd6
7 changed files with 23 additions and 17 deletions
|
|
@ -13,7 +13,7 @@ documentation = "https://docs.tealdeer.org"
|
|||
version = "1.8.1"
|
||||
include = ["/src/**/*", "/tests/**/*", "/Cargo.toml", "/README.md", "/LICENSE-*", "/screenshot.png", "completion/*"]
|
||||
rust-version = "1.87" # MSRV
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
|
||||
[[bin]]
|
||||
name = "tldr"
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@ use std::{
|
|||
time::{Duration, SystemTime},
|
||||
};
|
||||
|
||||
use anyhow::{anyhow, bail, ensure, Context, Result};
|
||||
use anyhow::{Context, Result, anyhow, bail, ensure};
|
||||
use log::{debug, info};
|
||||
use ureq::{
|
||||
Agent,
|
||||
http::StatusCode,
|
||||
tls::{RootCerts, TlsConfig, TlsProvider},
|
||||
Agent,
|
||||
};
|
||||
use zip::ZipArchive;
|
||||
|
||||
|
|
@ -128,7 +128,7 @@ impl<'a> Cache<'a> {
|
|||
None
|
||||
}
|
||||
|
||||
pub fn list_pages(&self) -> Result<impl IntoIterator<Item = String>> {
|
||||
pub fn list_pages(&self) -> Result<impl IntoIterator<Item = String> + use<>> {
|
||||
let mut pages = Vec::new();
|
||||
|
||||
let mut append_all = |directory: &Path, suffix: &str| -> Result<()> {
|
||||
|
|
@ -215,7 +215,7 @@ impl<'a> Cache<'a> {
|
|||
&mut self,
|
||||
archive_url: &str,
|
||||
tls_backend: TlsBackend,
|
||||
) -> Result<impl IntoIterator<Item = Language<'_>>> {
|
||||
) -> Result<impl IntoIterator<Item = Language<'_>> + use<'_>> {
|
||||
let client = Self::build_client(tls_backend);
|
||||
|
||||
// Download everything before deleting anything
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use std::path::PathBuf;
|
||||
|
||||
use clap::{builder::ArgAction, ArgGroup, Parser};
|
||||
use clap::{ArgGroup, Parser, builder::ArgAction};
|
||||
|
||||
use crate::types::{ColorOptions, PlatformType};
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ use std::{
|
|||
time::Duration,
|
||||
};
|
||||
|
||||
use anyhow::{anyhow, bail, ensure, Context, Result};
|
||||
use anyhow::{Context, Result, anyhow, bail, ensure};
|
||||
use clap::ValueEnum;
|
||||
use log::info;
|
||||
use serde::Serialize as _;
|
||||
|
|
@ -42,7 +42,7 @@ struct SystemDirectories {
|
|||
impl SystemDirectories {
|
||||
fn discover() -> Result<Self> {
|
||||
use etcetera::{
|
||||
app_strategy::choose_native_strategy, choose_app_strategy, AppStrategy, AppStrategyArgs,
|
||||
AppStrategy, AppStrategyArgs, app_strategy::choose_native_strategy, choose_app_strategy,
|
||||
};
|
||||
|
||||
let args = AppStrategyArgs {
|
||||
|
|
@ -579,7 +579,7 @@ impl TryFrom<RawTlsBackend> for TlsBackend {
|
|||
"Unsupported TLS backend: {}. This tealdeer build has support for the following options: {}",
|
||||
raw,
|
||||
supported_tls_backends_string(),
|
||||
))
|
||||
)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -654,7 +654,9 @@ impl<'a> Config<'a> {
|
|||
// For backwards compatibility reasons, the cache directory can be
|
||||
// overridden using an env variable. This is deprecated and will be
|
||||
// phased out in the future.
|
||||
eprintln!("Warning: The ${cache_dir_env_var} env variable is deprecated, use the `cache_dir` option in the config file instead.");
|
||||
eprintln!(
|
||||
"Warning: The ${cache_dir_env_var} env variable is deprecated, use the `cache_dir` option in the config file instead."
|
||||
);
|
||||
PathWithSource {
|
||||
path: PathBuf::from(env_var),
|
||||
source: PathSource::EnvVar,
|
||||
|
|
@ -766,7 +768,7 @@ impl ConfigLoader {
|
|||
return Err(e).context(format!(
|
||||
"Could not read config file contents from {}.",
|
||||
path.path().display()
|
||||
))
|
||||
));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -794,7 +796,9 @@ impl ConfigLoader {
|
|||
let mut entry = &mut config_table;
|
||||
for subkey in name.split('.') {
|
||||
let toml::Value::Table(entry_table) = entry else {
|
||||
bail!("\"{name}\" is not a valid identifier since \"{subkey}\" already refers to a value which is not a toml-Table.");
|
||||
bail!(
|
||||
"\"{name}\" is not a valid identifier since \"{subkey}\" already refers to a value which is not a toml-Table."
|
||||
);
|
||||
};
|
||||
|
||||
entry = entry_table
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ use std::{
|
|||
process::{Command, ExitCode},
|
||||
};
|
||||
|
||||
use anyhow::{anyhow, Context, Result};
|
||||
use anyhow::{Context, Result, anyhow};
|
||||
use cache::{CacheConfig, TLDR_OLD_PAGES_DIR};
|
||||
use clap::Parser;
|
||||
use config::{ConfigLoader, Language, StyleConfig, TlsBackend};
|
||||
|
|
@ -56,7 +56,7 @@ use crate::{
|
|||
cache::{Cache, PageLookupResult, TLDR_PAGES_DIR},
|
||||
cli::Cli,
|
||||
config::{
|
||||
get_config_dir, make_default_config, supported_tls_backends_string, Config, PathWithSource,
|
||||
Config, PathWithSource, get_config_dir, make_default_config, supported_tls_backends_string,
|
||||
},
|
||||
output::print_page,
|
||||
types::ColorOptions,
|
||||
|
|
@ -324,7 +324,9 @@ fn try_main(args: Cli, enable_styles: bool) -> Result<ExitCode> {
|
|||
print_error(enable_styles, &e);
|
||||
|
||||
eprintln!();
|
||||
eprintln!("Note: Update errors are often caused by unexpected or missing TLS certificates.");
|
||||
eprintln!(
|
||||
"Note: Update errors are often caused by unexpected or missing TLS certificates."
|
||||
);
|
||||
eprintln!(
|
||||
"You are currently using the following TLS backend: {}",
|
||||
config.updates.tls_backend,
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ use yansi::Paint;
|
|||
|
||||
use crate::{
|
||||
config::{Config, StyleConfig},
|
||||
formatter::{highlight_lines, PageSnippet},
|
||||
formatter::{PageSnippet, highlight_lines},
|
||||
line_iterator::LineIterator,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
//! Integration tests.
|
||||
|
||||
use std::{
|
||||
fs::{self, create_dir_all, File},
|
||||
fs::{self, File, create_dir_all},
|
||||
io::{self, Write},
|
||||
path::{Path, PathBuf},
|
||||
process::Command,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue