mirror of
https://github.com/enso-org/enso.git
synced 2024-11-22 11:52:59 +03:00
Bump rustc to nightly-2023-01-12 (#4053)
Bump rustc nightly-2022-08-30 and fix new errors and lints. https://www.pivotaltracker.com/story/show/184229094
This commit is contained in:
parent
b8a4a70f10
commit
349cc210e0
@ -9,3 +9,9 @@ rustflags = [
|
||||
"-C",
|
||||
"link-args=-z stack-size=2097152",
|
||||
]
|
||||
|
||||
[target.x86_64-pc-windows-msvc]
|
||||
rustflags = ["-C", "link-arg=/STACK:2097152"]
|
||||
|
||||
[target.x86_64-pc-windows-gnu]
|
||||
rustflags = ["-C", "link-arg=-Wl,--stack,2097152"]
|
||||
|
@ -1,7 +1,7 @@
|
||||
const CONFIG_PATH: &str = "../config.yaml";
|
||||
|
||||
fn main() {
|
||||
println!("cargo:rerun-if-changed={}", CONFIG_PATH);
|
||||
println!("cargo:rerun-if-changed={CONFIG_PATH}");
|
||||
println!("cargo:rerun-if-changed=build.rs");
|
||||
|
||||
config_reader::generate_config_module_from_yaml(CONFIG_PATH);
|
||||
|
@ -28,7 +28,7 @@ include!(concat!(env!("OUT_DIR"), "/config.rs"));
|
||||
pub use generated::*;
|
||||
|
||||
pub fn engine_version_requirement() -> semver::VersionReq {
|
||||
semver::VersionReq::parse(&format!("^{}", engine_version_supported)).unwrap()
|
||||
semver::VersionReq::parse(&format!("^{engine_version_supported}")).unwrap()
|
||||
}
|
||||
|
||||
|
||||
|
@ -35,7 +35,7 @@ impl Case {
|
||||
pub fn from_markdown(marked_code: impl Str) -> Case {
|
||||
// Regexp that matches either «sth» or »sth« into a group named `introduced` or `used`,
|
||||
// respectively. See: https://regex101.com/r/pboF8O/2 for detailed explanation.
|
||||
let regex = format!(r"«(?P<{}>[^»]*)»|»(?P<{}>[^«]*)«", INTRODUCED, USED);
|
||||
let regex = format!(r"«(?P<{INTRODUCED}>[^»]*)»|»(?P<{USED}>[^«]*)«");
|
||||
// As this is test utils, we don't try nicely handling failure nor reusing the compiled
|
||||
// regexp between calls to save some cycles.
|
||||
let regex = Regex::new(®ex).unwrap();
|
||||
@ -87,7 +87,7 @@ impl Replacer for MarkdownReplacer {
|
||||
} else if let Some(used) = captures.name(USED) {
|
||||
(Kind::Used, used)
|
||||
} else {
|
||||
panic!("Unexpected capture: expected named capture `{}` or `{}`.", INTRODUCED, USED)
|
||||
panic!("Unexpected capture: expected named capture `{INTRODUCED}` or `{USED}`.")
|
||||
};
|
||||
|
||||
let span = self.processor.process_match(captures, &matched, dst);
|
||||
|
@ -190,7 +190,7 @@ mod tests {
|
||||
|
||||
fn from_block(code: impl Str) -> TestRun {
|
||||
let body = code.as_ref().lines().map(|line| format!(" {}", line.trim())).join("\n");
|
||||
let definition_code = format!("main =\n{}", body);
|
||||
let definition_code = format!("main =\n{body}");
|
||||
Self::from_main_def(definition_code)
|
||||
}
|
||||
|
||||
|
@ -63,10 +63,10 @@ impl Display for Id {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
let mut iter = self.crumbs.iter();
|
||||
if let Some(crumb) = iter.next() {
|
||||
write!(f, "{}", crumb)?
|
||||
write!(f, "{crumb}")?
|
||||
}
|
||||
for crumb in iter {
|
||||
write!(f, "⮚{}", crumb)?
|
||||
write!(f, "⮚{crumb}")?
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
@ -218,7 +218,7 @@ impl DefinitionName {
|
||||
impl Display for DefinitionName {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
let text = self.name_segments().join(ast::opr::predefined::ACCESS);
|
||||
write!(f, "{}", text)
|
||||
write!(f, "{text}")
|
||||
}
|
||||
}
|
||||
|
||||
@ -788,7 +788,7 @@ mod tests {
|
||||
let (crumb,) = location.crumbs.expect_tuple();
|
||||
match crumb {
|
||||
ast::crumbs::Crumb::Module(m) => assert_eq!(m.line_index, expected_line_index),
|
||||
_ => panic!("Expected module crumb, got: {:?}.", crumb),
|
||||
_ => panic!("Expected module crumb, got: {crumb:?}."),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -183,24 +183,20 @@ impl Display for Info {
|
||||
let from_kw = ast::macros::UNQUALIFIED_IMPORT_KEYWORD;
|
||||
match &self.imported {
|
||||
ImportedNames::Module { alias } => {
|
||||
write!(f, "{} {}", import_kw, module)?;
|
||||
write!(f, "{import_kw} {module}")?;
|
||||
if let Some(alias) = alias {
|
||||
write!(f, " {} {}", ALIAS_KEYWORD, alias)?;
|
||||
write!(f, " {ALIAS_KEYWORD} {alias}")?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
ImportedNames::All => write!(f, "{} {} {} {}", from_kw, module, import_kw, ALL_KEYWORD),
|
||||
ImportedNames::All => write!(f, "{from_kw} {module} {import_kw} {ALL_KEYWORD}"),
|
||||
ImportedNames::List { names } => {
|
||||
let names = names.iter().join(", ");
|
||||
write!(f, "{} {} {} {}", from_kw, module, import_kw, names)
|
||||
write!(f, "{from_kw} {module} {import_kw} {names}")
|
||||
}
|
||||
ImportedNames::AllExcept { not_imported: hidden_names } => {
|
||||
let names = hidden_names.iter().join(", ");
|
||||
write!(
|
||||
f,
|
||||
"{} {} {} {} {} {}",
|
||||
from_kw, module, import_kw, ALL_KEYWORD, HIDING_KEYWORD, names
|
||||
)
|
||||
write!(f, "{from_kw} {module} {import_kw} {ALL_KEYWORD} {HIDING_KEYWORD} {names}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -229,7 +229,7 @@ mod test {
|
||||
let change = enso_text::Change { range, text: inserted_code.to_string() };
|
||||
Case { code, change }
|
||||
}
|
||||
_ => panic!("Invalid markdown in the marked code: {}.", marked_code),
|
||||
_ => panic!("Invalid markdown in the marked code: {marked_code}."),
|
||||
}
|
||||
}
|
||||
|
||||
@ -259,7 +259,7 @@ mod test {
|
||||
let ids2 = main_nodes(ast2);
|
||||
debug!("IDs1: {ids1:?}");
|
||||
debug!("IDs2: {ids2:?}");
|
||||
assert_eq!(ids1, ids2, "Node ids mismatch in {:?}", self);
|
||||
assert_eq!(ids1, ids2, "Node ids mismatch in {self:?}");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,9 +30,8 @@ const ENABLE_ENV_VAR_NAME: &str = "ENSO_IDE_ENABLE_FLATC";
|
||||
|
||||
/// An URL pointing to engine interface files.
|
||||
pub fn interface_description_url() -> reqwest::Url {
|
||||
let url =
|
||||
format!("https://packages.luna-lang.org/fbs-schema/nightly/{}/fbs-schema.zip", COMMIT);
|
||||
let err = format!("{} is an invalid URL.", url);
|
||||
let url = format!("https://packages.luna-lang.org/fbs-schema/nightly/{COMMIT}/fbs-schema.zip");
|
||||
let err = format!("{url} is an invalid URL.");
|
||||
reqwest::Url::parse(&url).expect(&err)
|
||||
}
|
||||
|
||||
@ -68,10 +67,10 @@ impl ApiProvider {
|
||||
pub fn unzip(&self, artifacts: bytes::Bytes) {
|
||||
let zip_path = self.out_dir.join(ZIP_NAME);
|
||||
let display_path = zip_path.display();
|
||||
let open_error = format!("Failed to open {}", display_path);
|
||||
let write_error = format!("Failed to write {}", display_path);
|
||||
let flush_error = format!("Failed to flush {}", display_path);
|
||||
let unzip_error = format!("Failed to unzip {}", display_path);
|
||||
let open_error = format!("Failed to open {display_path}");
|
||||
let write_error = format!("Failed to write {display_path}");
|
||||
let flush_error = format!("Failed to flush {display_path}");
|
||||
let unzip_error = format!("Failed to unzip {display_path}");
|
||||
|
||||
let mut file = File::create(&zip_path).expect(&open_error);
|
||||
file.write_all(&artifacts).expect(&write_error);
|
||||
@ -136,12 +135,12 @@ async fn main() -> std::result::Result<(), Box<dyn std::error::Error>> {
|
||||
provider.run().await;
|
||||
} else {
|
||||
println!(
|
||||
"cargo:info=Will not try updating flatc-generated files. Define `{}` environment \
|
||||
variable to enable regeneration of the Engine API flatc bindings.",
|
||||
ENABLE_ENV_VAR_NAME
|
||||
"cargo:info=Will not try updating flatc-generated files. Define \
|
||||
`{ENABLE_ENV_VAR_NAME}` environment variable to enable regeneration of the Engine API \
|
||||
flatc bindings.",
|
||||
);
|
||||
}
|
||||
println!("cargo:rerun-if-changed=build.rs");
|
||||
println!("cargo:rerun-if-env-changed={}", ENABLE_ENV_VAR_NAME);
|
||||
println!("cargo:rerun-if-env-changed={ENABLE_ENV_VAR_NAME}");
|
||||
Ok(())
|
||||
}
|
||||
|
@ -390,7 +390,7 @@ mod tests {
|
||||
let (event, tail) = event_fut.expect_ready();
|
||||
match event.expect("Expected some notification.") {
|
||||
Event::Notification(notification) => assert_eq!(notification, expected_notification),
|
||||
event => panic!("Expected notification event, got: {:?}", event),
|
||||
event => panic!("Expected notification event, got: {event:?}"),
|
||||
}
|
||||
tail.boxed_local().expect_pending();
|
||||
}
|
||||
|
@ -287,7 +287,7 @@ mod tests {
|
||||
#[test]
|
||||
fn test_closed_socked_event_passing() {
|
||||
let mut transport = MockTransport::new();
|
||||
let processor = |msg| panic!("Must never be called in this test, but got {:?}!", msg);
|
||||
let processor = |msg| panic!("Must never be called in this test, but got {msg:?}!");
|
||||
let handler = Handler::<i32, (), ()>::new(transport.clone_ref(), processor);
|
||||
let mut runner = handler.runner().boxed_local();
|
||||
let mut events = handler.event_stream().boxed_local();
|
||||
@ -299,7 +299,7 @@ mod tests {
|
||||
runner.expect_pending();
|
||||
|
||||
let event = events.expect_next();
|
||||
assert!(matches!(event, Event::Closed), "Event was: {:?}", event);
|
||||
assert!(matches!(event, Event::Closed), "Event was: {event:?}");
|
||||
events.expect_pending();
|
||||
}
|
||||
}
|
||||
|
@ -189,12 +189,12 @@ pub mod svg {
|
||||
)?;
|
||||
let y_pos = HEADER_HEIGHT + GRID_INTERVAL_MS * i as f64;
|
||||
let x_len = POLE_SPACING * dia.processes.len() as f64;
|
||||
let path = format!("M0,{} l{},0", y_pos, x_len);
|
||||
writeln!(f, "<path fill=\"none\" stroke=\"#{}\" d=\"{}\"/>", GRID_COLOR_RGB, path)?;
|
||||
let path = format!("M0,{y_pos} l{x_len},0");
|
||||
writeln!(f, "<path fill=\"none\" stroke=\"#{GRID_COLOR_RGB}\" d=\"{path}\"/>")?;
|
||||
}
|
||||
for i in 1..dia.processes.len() {
|
||||
let path = format!("M{},{} l0,{}", POLE_SPACING * i as f64, HEADER_HEIGHT, height);
|
||||
writeln!(f, "<path fill=\"none\" stroke=\"black\" d=\"{}\"/>", path)?;
|
||||
writeln!(f, "<path fill=\"none\" stroke=\"black\" d=\"{path}\"/>")?;
|
||||
}
|
||||
let simple_only = "Drawing messages between non-adjacent processes is not implemented.";
|
||||
let mut pairs = std::collections::HashMap::new();
|
||||
|
@ -53,7 +53,7 @@ impl Display for Metadata {
|
||||
Metadata::RpcEvent(name) => f.collect_str(name),
|
||||
Metadata::RpcRequest(method) => f.collect_str(&method.to_string()),
|
||||
Metadata::BackendMessage(backend::Message { endpoint, .. }) => f.collect_str(endpoint),
|
||||
Metadata::RenderStats(stats) => f.collect_str(&format!("{:#?}", stats)),
|
||||
Metadata::RenderStats(stats) => f.collect_str(&format!("{stats:#?}")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -407,7 +407,7 @@ impl<'de> Visitor<'de> for AstDeserializationVisitor {
|
||||
|
||||
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
use ast_schema::*;
|
||||
write!(formatter, "an object with `{}` and `{}` fields", SHAPE, LENGTH)
|
||||
write!(formatter, "an object with `{SHAPE}` and `{LENGTH}` fields")
|
||||
}
|
||||
|
||||
fn visit_map<A>(self, mut map: A) -> Result<Self::Value, A::Error>
|
||||
@ -1763,7 +1763,7 @@ mod tests {
|
||||
let v = Ast::var(name.clone());
|
||||
match v.shape() {
|
||||
Shape::Var(var) if *var.name == name => (),
|
||||
_ => panic!("expected Var with name `{}`", name),
|
||||
_ => panic!("expected Var with name `{name}`"),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@ where &'t Shape<Ast>: TryInto<&'t T> {
|
||||
Ok(shape) => shape,
|
||||
_ => {
|
||||
let expected_typename = std::any::type_name::<T>();
|
||||
panic!("failed converting shape into {}, got {:?}", expected_typename, ast)
|
||||
panic!("failed converting shape into {expected_typename}, got {ast:?}")
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -46,8 +46,8 @@ pub fn assert_unique_ids(ast: &Ast) {
|
||||
if let Some(id) = node.id {
|
||||
if let Some(id2) = ids.insert(id, node) {
|
||||
panic!(
|
||||
"Collision for id {} between `{}` and `{}`.\n\nWhole program is:\n{}",
|
||||
id, id2, node, ast
|
||||
"Collision for id {id} between `{id2}` and `{node}`.\
|
||||
\n\nWhole program is:\n{ast}"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ pub fn parser_url(version: &ParserVersion) -> reqwest::Url {
|
||||
"https://packages.luna-lang.org/parser-js/nightly/{}/scala-parser.js",
|
||||
version.commit
|
||||
);
|
||||
let invalid_url_msg = format!("{} is an invalid URL.", url_string);
|
||||
let invalid_url_msg = format!("{url_string} is an invalid URL.");
|
||||
reqwest::Url::parse(&url_string).expect(&invalid_url_msg)
|
||||
}
|
||||
|
||||
@ -129,7 +129,7 @@ async fn main() -> Result {
|
||||
provider.run().await?;
|
||||
}
|
||||
println!("cargo:rerun-if-changed=build.rs");
|
||||
println!("cargo:rerun-if-changed={}", PARSER_PATH);
|
||||
println!("cargo:rerun-if-changed={PARSER_PATH}");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ impl<M: Metadata> TryFrom<&ParsedSourceFile<M>> for String {
|
||||
impl<M: Metadata> Display for ParsedSourceFile<M> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self.serialize() {
|
||||
Ok(serialized) => write!(f, "{}", serialized),
|
||||
Ok(serialized) => write!(f, "{serialized}"),
|
||||
Err(_) => write!(f, "[NOT REPRESENTABLE SOURCE FILE]"),
|
||||
}
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ impl Parser {
|
||||
|
||||
/// Obtains a default parser implementation, panicking in case of failure.
|
||||
pub fn new_or_panic() -> Parser {
|
||||
Parser::new().unwrap_or_else(|e| panic!("Failed to create a parser: {:?}", e))
|
||||
Parser::new().unwrap_or_else(|e| panic!("Failed to create a parser: {e:?}"))
|
||||
}
|
||||
|
||||
/// Parse program.
|
||||
@ -208,7 +208,7 @@ impl DocParser {
|
||||
|
||||
/// Obtains a default doc parser implementation, panicking in case of failure.
|
||||
pub fn new_or_panic() -> DocParser {
|
||||
DocParser::new().unwrap_or_else(|e| panic!("Failed to create doc parser: {:?}", e))
|
||||
DocParser::new().unwrap_or_else(|e| panic!("Failed to create doc parser: {e:?}"))
|
||||
}
|
||||
|
||||
/// Parses program with documentation and generates HTML code.
|
||||
|
@ -44,7 +44,7 @@ impl ParserTestExts for Parser {
|
||||
let ast = self.parse(program.clone(), default()).unwrap();
|
||||
assert_eq!(ast.shape().len(), program.len().bytes());
|
||||
validate_spans(&ast);
|
||||
assert_eq!(ast.repr(), program, "{:?}", ast);
|
||||
assert_eq!(ast.repr(), program, "{ast:?}");
|
||||
ast
|
||||
}
|
||||
}
|
||||
|
@ -36,10 +36,10 @@ pub fn to_assignment_test() {
|
||||
let expected_not_assignments = vec!["= 5", "a=", "=", "foo", "a->b", "a+b"];
|
||||
|
||||
for code in expected_assignments {
|
||||
assert!(is_assignment(code), "{} expected to be recognized as assignment", code);
|
||||
assert!(is_assignment(code), "{code} expected to be recognized as assignment");
|
||||
}
|
||||
for code in expected_not_assignments {
|
||||
assert!(!is_assignment(code), "{} expected to not be recognized as assignment", code);
|
||||
assert!(!is_assignment(code), "{code} expected to not be recognized as assignment");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ fn no_doc_found() {
|
||||
let parser = parser_scala::DocParser::new_or_panic();
|
||||
let gen_code = parser.generate_html_docs(program).unwrap();
|
||||
// gen_code should be empty.
|
||||
assert_eq!(gen_code.len(), 22, "Generated length differs from the expected\"{}\"", gen_code);
|
||||
assert_eq!(gen_code.len(), 22, "Generated length differs from the expected\"{gen_code}\"");
|
||||
}
|
||||
|
||||
#[wasm_bindgen_test]
|
||||
|
@ -21,7 +21,7 @@ fn import_utilities() {
|
||||
let parser = Parser::new_or_panic();
|
||||
let expect_import = |code: &str| {
|
||||
let ast = parser.parse_line_ast(code).unwrap();
|
||||
assert!(is_ast_import(&ast), "Not Ast import: {:?}", ast);
|
||||
assert!(is_ast_import(&ast), "Not Ast import: {ast:?}");
|
||||
let ast_match = ast_as_import_match(&ast).unwrap();
|
||||
assert_eq!(&ast, ast_match.ast());
|
||||
assert!(is_match_import(&ast_match));
|
||||
|
@ -43,7 +43,7 @@ fn assert_opr<StringLike: Into<String>>(ast: &Ast, name: StringLike) {
|
||||
|
||||
fn roundtrip_program_with(parser: &parser_scala::Parser, program: &str) {
|
||||
let ast = parser.parse(program.to_string(), Default::default()).unwrap();
|
||||
assert_eq!(ast.repr(), program, "{:#?}", ast);
|
||||
assert_eq!(ast.repr(), program, "{ast:#?}");
|
||||
}
|
||||
|
||||
fn roundtrip_program(program: &str) {
|
||||
@ -414,9 +414,9 @@ impl Fixture {
|
||||
];
|
||||
|
||||
for macro_usage in macro_usages.iter() {
|
||||
println!(">>>>>>>>>> {}", macro_usage);
|
||||
println!(">>>>>>>>>> {macro_usage}");
|
||||
let ast = self.parser.parse_line_ast(*macro_usage).unwrap();
|
||||
println!("{:?}", ast);
|
||||
println!("{ast:?}");
|
||||
expect_shape::<Match<Ast>>(&ast);
|
||||
}
|
||||
}
|
||||
|
@ -268,8 +268,8 @@ mod test {
|
||||
}
|
||||
.unwrap();
|
||||
let result_repr = result.repr();
|
||||
assert_eq!(result_repr, self.expected, "Wrong answer for case {:?}", self);
|
||||
assert_eq!(ast_id, result.id, "Changed AST id in case {:?}", self);
|
||||
assert_eq!(result_repr, self.expected, "Wrong answer for case {self:?}");
|
||||
assert_eq!(ast_id, result.id, "Changed AST id in case {self:?}");
|
||||
}
|
||||
}
|
||||
|
||||
@ -351,9 +351,7 @@ mod test {
|
||||
assert_eq!(
|
||||
node.is_action_available(*action),
|
||||
expected.contains(action),
|
||||
"Availability mismatch for action {:?} in case {:?}",
|
||||
action,
|
||||
self
|
||||
"Availability mismatch for action {action:?} in case {self:?}"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -672,7 +672,7 @@ mod test {
|
||||
for id_map_entry in id_map.vec {
|
||||
let (span, id) = id_map_entry;
|
||||
let node = tree.root_ref().find_by_span(&span);
|
||||
assert!(node.is_some(), "Node with span {} not found", span);
|
||||
assert!(node.is_some(), "Node with span {span} not found");
|
||||
assert_eq!(node.unwrap().node.ast_id, Some(id));
|
||||
}
|
||||
|
||||
|
@ -1567,7 +1567,7 @@ main =
|
||||
let connection = Connection { source, destination };
|
||||
graph.connect(&connection, &span_tree::generate::context::Empty).unwrap();
|
||||
let new_main = graph.definition().unwrap().ast.repr();
|
||||
assert_eq!(new_main, expected, "Case {:?}", this);
|
||||
assert_eq!(new_main, expected, "Case {this:?}");
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -1741,7 +1741,7 @@ main =
|
||||
let connection = connections.connections.first().unwrap();
|
||||
graph.disconnect(connection, &span_tree::generate::context::Empty).unwrap();
|
||||
let new_main = graph.definition().unwrap().ast.repr();
|
||||
assert_eq!(new_main, expected, "Case {:?}", this);
|
||||
assert_eq!(new_main, expected, "Case {this:?}");
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ pub const MAIN_DEFINITION_NAME: &str = "main";
|
||||
|
||||
/// The code with definition of the default `main` method.
|
||||
pub fn default_main_method_code() -> String {
|
||||
format!(r#"{} = "Hello, World!""#, MAIN_DEFINITION_NAME)
|
||||
format!(r#"{MAIN_DEFINITION_NAME} = "Hello, World!""#)
|
||||
}
|
||||
|
||||
/// The default content of the newly created initial main module file.
|
||||
@ -57,10 +57,10 @@ pub fn main_method_ptr(
|
||||
pub fn package_yaml_path(project_name: &str) -> String {
|
||||
match platform::current() {
|
||||
Some(Platform::Linux) | Some(Platform::MacOS) =>
|
||||
format!("~/enso/projects/{}/package.yaml", project_name),
|
||||
format!("~/enso/projects/{project_name}/package.yaml"),
|
||||
Some(Platform::Windows) =>
|
||||
format!("%userprofile%\\enso\\projects\\{}\\package.yaml", project_name),
|
||||
_ => format!("<path-to-enso-projects>/{}/package.yaml", project_name),
|
||||
format!("%userprofile%\\enso\\projects\\{project_name}\\package.yaml"),
|
||||
_ => format!("<path-to-enso-projects>/{project_name}/package.yaml"),
|
||||
}
|
||||
}
|
||||
|
||||
@ -300,7 +300,7 @@ mod tests {
|
||||
assert_eq!(code, module.ast().repr());
|
||||
};
|
||||
expect_intact("main = 5");
|
||||
expect_intact(&format!("{}.main = 5", module_name));
|
||||
expect_intact(&format!("{module_name}.main = 5"));
|
||||
}
|
||||
|
||||
|
||||
|
@ -2275,7 +2275,7 @@ pub mod test {
|
||||
let parser = Parser::new_or_panic();
|
||||
let ast = parser.parse_line_ast(self.before).unwrap();
|
||||
let new_ast = apply_this_argument("foo", &ast);
|
||||
assert_eq!(new_ast.repr(), self.after, "Case {:?} failed: {:?}", self, ast);
|
||||
assert_eq!(new_ast.repr(), self.after, "Case {self:?} failed: {ast:?}");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -179,9 +179,9 @@ impl Display for Component {
|
||||
let self_type_not_here = self_type_ref.filter(|t| *t != &entry.defined_in);
|
||||
if let Some(self_type) = self_type_not_here {
|
||||
let self_name = self_type.name().from_case(Case::Snake).to_case(Case::Title);
|
||||
write!(f, "{} {}", self_name, entry_name)
|
||||
write!(f, "{self_name} {entry_name}")
|
||||
} else {
|
||||
write!(f, "{}", entry_name)
|
||||
write!(f, "{entry_name}")
|
||||
}
|
||||
}
|
||||
Data::Virtual { snippet } => write!(f, "{}", snippet.name),
|
||||
|
@ -557,7 +557,7 @@ mod tests {
|
||||
builder.extend_list_and_allow_favorites_with_ids(&db, std::iter::once(1));
|
||||
let list = builder.build();
|
||||
let favorites = list.favorites;
|
||||
assert_eq!(favorites.len(), 1, "Expected one group of favorites, got: {:?}.", favorites);
|
||||
assert_eq!(favorites.len(), 1, "Expected one group of favorites, got: {favorites:?}.");
|
||||
let expected_entry_names = ["test snippet", qn_of_db_entry_1.name()];
|
||||
check_names_and_order_of_group_entries(&favorites[0], &expected_entry_names);
|
||||
}
|
||||
@ -585,7 +585,7 @@ mod tests {
|
||||
builder.extend_list_and_allow_favorites_with_ids(&db, std::iter::once(1));
|
||||
let list = builder.build();
|
||||
let favorites = list.favorites;
|
||||
assert_eq!(favorites.len(), 2, "Expected two groups of favorites, got: {:?}.", favorites);
|
||||
assert_eq!(favorites.len(), 2, "Expected two groups of favorites, got: {favorites:?}.");
|
||||
let group_at_0 = &favorites[0];
|
||||
assert_eq!(group_at_0.name, "Group 2");
|
||||
check_names_and_order_of_group_entries(group_at_0, &["test snippet"]);
|
||||
|
@ -96,7 +96,7 @@ impl Group {
|
||||
let name = if entry.defined_in.is_top_element() || entry.defined_in.is_main_module() {
|
||||
let project = &entry.defined_in.project().project;
|
||||
let module = entry.defined_in.name();
|
||||
format!("{}.{}", project, module)
|
||||
format!("{project}.{module}")
|
||||
} else {
|
||||
entry.defined_in.name().to_owned()
|
||||
};
|
||||
|
@ -308,11 +308,11 @@ impl NodeFromDroppedFileHandler {
|
||||
}
|
||||
|
||||
fn uploading_node_expression(name: &str) -> String {
|
||||
format!("File_Uploading.file_uploading Enso_Project.data/\"{}\"", name)
|
||||
format!("File_Uploading.file_uploading Enso_Project.data/\"{name}\"")
|
||||
}
|
||||
|
||||
fn uploaded_node_expression(name: &str) -> String {
|
||||
format!("enso_project.data/\"{}\" . read", name)
|
||||
format!("enso_project.data/\"{name}\" . read")
|
||||
}
|
||||
|
||||
fn data_path(&self) -> Path {
|
||||
|
@ -228,8 +228,7 @@ impl Display for UnsupportedEngineVersion {
|
||||
write!(
|
||||
f,
|
||||
"Failed to open project: unsupported engine version. Please update \
|
||||
engine_version in {} to {}.",
|
||||
package_yaml_path, version_supported
|
||||
engine_version in {package_yaml_path} to {version_supported}."
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ impl<Handle: Clone + CloneRef> CloneRef for Entry<Handle> {
|
||||
impl<Handle: Debug> Debug for Entry<Handle> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
|
||||
match self {
|
||||
Entry::Loaded(handle) => write!(f, "Entry::Loaded({:?})", handle),
|
||||
Entry::Loaded(handle) => write!(f, "Entry::Loaded({handle:?})"),
|
||||
Entry::Loading(_) => write!(f, "Entry::Loading"),
|
||||
}
|
||||
}
|
||||
|
@ -166,13 +166,13 @@ impl Display for Frame {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "Name: {}; ", self.name)?;
|
||||
if let Some(m) = &self.module {
|
||||
write!(f, "Module: {}; ", m)?;
|
||||
write!(f, "Module: {m}; ")?;
|
||||
}
|
||||
if let Some(g) = &self.graph {
|
||||
write!(f, "Graph: {}; ", g)?;
|
||||
write!(f, "Graph: {g}; ")?;
|
||||
}
|
||||
for (id, code) in &self.snapshots {
|
||||
write!(f, "Code for {}: {}; ", id, code)?;
|
||||
write!(f, "Code for {id}: {code}; ")?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
@ -592,7 +592,7 @@ main =
|
||||
let node = &nodes[0];
|
||||
|
||||
// Check initial state.
|
||||
assert_eq!(urm.repository.len(Stack::Undo), 0, "Undo stack not empty: {:?}", urm);
|
||||
assert_eq!(urm.repository.len(Stack::Undo), 0, "Undo stack not empty: {urm:?}");
|
||||
assert_eq!(module.ast().to_string(), "main = \n 2 + 2");
|
||||
|
||||
// Perform an action.
|
||||
|
@ -74,7 +74,7 @@ impl Model {
|
||||
*self.current_project.borrow_mut() = Some(project);
|
||||
}
|
||||
Err(err) => {
|
||||
let err_msg = format!("Failed to initialize project: {}", err);
|
||||
let err_msg = format!("Failed to initialize project: {err}");
|
||||
error!("{err_msg}");
|
||||
self.controller.status_notifications().publish_event(err_msg);
|
||||
}
|
||||
|
@ -639,7 +639,7 @@ mod tests {
|
||||
let attached_id = if let ExecutionContextRequest::Attach(vis) = request {
|
||||
vis.id
|
||||
} else {
|
||||
panic!("Expected request to be `ExecutionContextRequest::Attach`, found {:?}", request)
|
||||
panic!("Expected request to be `ExecutionContextRequest::Attach`, found {request:?}")
|
||||
};
|
||||
|
||||
// Multiple detach-attach requests are collapsed into a single modify request.
|
||||
@ -678,7 +678,7 @@ mod tests {
|
||||
match requests.expect_next() {
|
||||
ExecutionContextRequest::Detach(id) =>
|
||||
assert_eq!(id, visualization_so_far.latest_id().unwrap()),
|
||||
other => panic!("Expected a detach request, got: {:?}", other),
|
||||
other => panic!("Expected a detach request, got: {other:?}"),
|
||||
}
|
||||
assert_matches!(requests.expect_next(), ExecutionContextRequest::Attach(vis)
|
||||
if matching_metadata(&vis,&desired_vis_3.metadata));
|
||||
|
@ -83,7 +83,7 @@ impl Example {
|
||||
|
||||
/// Creates a pretty documentation from hardcoded inner text.
|
||||
pub fn documentation_html_from(inner: &str) -> String {
|
||||
format!("<div class=\"doc\" style=\"font-size: 13px;\"><p>{}</p></div>", inner)
|
||||
format!("<div class=\"doc\" style=\"font-size: 13px;\"><p>{inner}</p></div>")
|
||||
}
|
||||
|
||||
// =========================
|
||||
|
@ -1071,19 +1071,19 @@ pub mod test {
|
||||
/// methods or constructors of the Type or Types defined in the module.
|
||||
fn verify_hierarchy_index(db: &SuggestionDatabase, name: &str, expected: &[&str]) {
|
||||
let id = lookup_id_by_name(db, name);
|
||||
let id = id.unwrap_or_else(|| panic!("No entry with name {}", name));
|
||||
let id = id.unwrap_or_else(|| panic!("No entry with name {name}"));
|
||||
let hierarchy_index = db.hierarchy_index.borrow();
|
||||
let actual_ids = hierarchy_index.get(&id);
|
||||
let actual_ids = actual_ids.unwrap_or_else(|| panic!("No entry for id {}", id));
|
||||
let actual_ids = actual_ids.unwrap_or_else(|| panic!("No entry for id {id}"));
|
||||
let id_from_name = |name: &&str| {
|
||||
lookup_id_by_name(db, name).unwrap_or_else(|| panic!("No entry with name {}", name))
|
||||
lookup_id_by_name(db, name).unwrap_or_else(|| panic!("No entry with name {name}"))
|
||||
};
|
||||
let expected_ids: HashSet<_> = expected.iter().map(id_from_name).collect();
|
||||
let name_from_id = |id: &entry::Id| {
|
||||
db.lookup(*id).map(|e| e.name.clone()).unwrap_or_else(|_| "<not found>".to_string())
|
||||
};
|
||||
let actual = actual_ids.iter().map(name_from_id).collect::<Vec<_>>();
|
||||
assert_eq!(actual_ids, &expected_ids, "Actual {:?} != expected {:?}", actual, expected);
|
||||
assert_eq!(actual_ids, &expected_ids, "Actual {actual:?} != expected {expected:?}");
|
||||
}
|
||||
|
||||
/// Test that hierarchy index is populated when the database is created from the language server
|
||||
|
@ -474,8 +474,7 @@ impl Model {
|
||||
}
|
||||
|
||||
fn entry_to_select_after_reset(&self, info: &content::Info) -> Option<(Row, Col)> {
|
||||
let top_module_sections =
|
||||
(0..info.namespace_section_count).into_iter().map(SectionId::Namespace);
|
||||
let top_module_sections = (0..info.namespace_section_count).map(SectionId::Namespace);
|
||||
let sections = iter::once(SectionId::Popular)
|
||||
.chain(top_module_sections)
|
||||
.chain(iter::once(SectionId::LocalScope));
|
||||
|
@ -178,7 +178,7 @@ pub mod background {
|
||||
ensogl_core::shape! {
|
||||
below = [grid::entry::background, grid_view::entry::overlay, grid_view::selectable::highlight::shape];
|
||||
(style:Style,bg_color:Vector4) {
|
||||
let alpha = Var::<f32>::from(format!("({0}.w)",bg_color));
|
||||
let alpha = Var::<f32>::from(format!("({bg_color}.w)"));
|
||||
let bg_color = &Var::<color::Rgba>::from(bg_color.clone());
|
||||
|
||||
let grid_padding = style.get_number(theme::grid::padding);
|
||||
|
@ -322,7 +322,7 @@ fn init(app: &Application) {
|
||||
|
||||
pub fn expression_mock_string(label: &str) -> Expression {
|
||||
let pattern = Some(label.to_string());
|
||||
let code = format!("\"{}\"", label);
|
||||
let code = format!("\"{label}\"");
|
||||
let parser = Parser::new_or_panic();
|
||||
let parameters = vec![];
|
||||
let ast = parser.parse_line_ast(&code).unwrap();
|
||||
|
@ -46,8 +46,7 @@ fn sample_text() -> String {
|
||||
}
|
||||
_ => {
|
||||
text.push_str(&format!(
|
||||
"{0:?} bottles of beer on the wall, {0:?} bottles of beer.",
|
||||
n
|
||||
"{n:?} bottles of beer on the wall, {n:?} bottles of beer."
|
||||
));
|
||||
text.push_str(&format!(
|
||||
"Take one down and pass it around, {} bottles of beer on the wall.\n",
|
||||
|
@ -525,7 +525,7 @@ fn arguments_list<'a>(arguments: &'a [Argument]) -> Box<dyn Render + 'a> {
|
||||
fn single_argument(argument: &Argument) -> impl Render {
|
||||
let Argument { name, default_value, .. } = argument;
|
||||
let text = if let Some(default_value) = default_value {
|
||||
format!("{} = {},", name, default_value)
|
||||
format!("{name} = {default_value},")
|
||||
} else {
|
||||
name.to_string()
|
||||
};
|
||||
|
@ -178,7 +178,7 @@ impl Model {
|
||||
let messages = default();
|
||||
|
||||
let styles = StyleWatch::new(&scene.style_sheet);
|
||||
let padding_text = format!("{}px", PADDING_TEXT);
|
||||
let padding_text = format!("{PADDING_TEXT}px");
|
||||
|
||||
dom.dom().set_attribute_or_warn("class", "visualization scrollable");
|
||||
dom.dom().set_style_or_warn("overflow-x", "hidden");
|
||||
|
@ -75,8 +75,8 @@ impl Entry {
|
||||
let height = size.y as u32;
|
||||
|
||||
let mut style = "position: absolute; white-space: pre; pointer-events: auto;".to_string();
|
||||
write!(style, "left: {}px; top: {}px;", left, top).ok();
|
||||
write!(style, "width: {}px; height: {}px;", width, height).ok();
|
||||
write!(style, "left: {left}px; top: {top}px;").ok();
|
||||
write!(style, "width: {width}px; height: {height}px;").ok();
|
||||
|
||||
self.text.set_attribute_or_warn("style", style);
|
||||
}
|
||||
|
@ -285,7 +285,7 @@ impl TryFrom<visualization::Data> for LazyGridDataUpdate {
|
||||
serde_json::to_string_pretty(&*content)
|
||||
};
|
||||
let data_str =
|
||||
data_str.unwrap_or_else(|e| format!("<Cannot render data: {}.>", e));
|
||||
data_str.unwrap_or_else(|e| format!("<Cannot render data: {e}.>"));
|
||||
(data_str.into(), UpdateType::FullUpdate)
|
||||
}
|
||||
};
|
||||
|
@ -82,7 +82,7 @@ mod icon {
|
||||
let arrow = Triangle(size.px(),size.px()).rotate((PI/2.0).radians());
|
||||
let arrow = arrow.translate_x(0.5.px());
|
||||
let shape = ring + arrow;
|
||||
let color = format!("vec4({},{},{},{})",red,green,blue,alpha);
|
||||
let color = format!("vec4({red},{green},{blue},{alpha})");
|
||||
let color : Var<color::Rgba> = color.into();
|
||||
shape.fill(color).into()
|
||||
}
|
||||
@ -104,7 +104,7 @@ mod separator {
|
||||
let size = SEPARATOR_SIZE;
|
||||
let angle = PI/2.0;
|
||||
let triangle = Triangle(size.px(),size.px()).rotate(angle.radians());
|
||||
let color = format!("vec4({},{},{},{})",red,green,blue,alpha);
|
||||
let color = format!("vec4({red},{green},{blue},{alpha})");
|
||||
let color : Var<color::Rgba> = color.into();
|
||||
triangle.fill(color).into()
|
||||
}
|
||||
|
@ -122,10 +122,10 @@ impl Container {
|
||||
let div = web::document.create_div_or_panic();
|
||||
let background_dom = DomSymbol::new(&div);
|
||||
let (width, height) = SIZE;
|
||||
let width = format!("{}.px", width);
|
||||
let height = format!("{}.px", height);
|
||||
let width = format!("{width}.px");
|
||||
let height = format!("{height}.px");
|
||||
let z_index = Z_INDEX.to_string();
|
||||
let border_radius = format!("{}.px", BORDER_RADIUS);
|
||||
let border_radius = format!("{BORDER_RADIUS}.px");
|
||||
background_dom.dom().set_style_or_warn("width", width);
|
||||
background_dom.dom().set_style_or_warn("height", height);
|
||||
background_dom.dom().set_style_or_warn("z-index", z_index);
|
||||
|
@ -61,13 +61,13 @@ impl Display for Status {
|
||||
let minutes = seconds / 60.0;
|
||||
let hours = minutes / 60.0;
|
||||
if hours >= 1.0 {
|
||||
write!(f, "{:.1} h", hours)
|
||||
write!(f, "{hours:.1} h")
|
||||
} else if minutes >= 1.0 {
|
||||
write!(f, "{:.1} m", minutes)
|
||||
write!(f, "{minutes:.1} m")
|
||||
} else if seconds >= 1.0 {
|
||||
write!(f, "{:.1} s", seconds)
|
||||
write!(f, "{seconds:.1} s")
|
||||
} else {
|
||||
write!(f, "{:.0} ms", milliseconds)
|
||||
write!(f, "{milliseconds:.0} ms")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -107,8 +107,7 @@ impl Display for InstantiationError {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
InstantiationError::ConstructorError(value) => f.write_fmt(format_args!(
|
||||
"Could not construct visualisation because of error: {:?}",
|
||||
value
|
||||
"Could not construct visualisation because of error: {value:?}"
|
||||
)),
|
||||
}
|
||||
}
|
||||
|
@ -130,9 +130,9 @@ impl Display for Error {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
Error::InvalidFunction(value) =>
|
||||
f.write_fmt(format_args!("Provided value is not a valid function: {:?}", value)),
|
||||
f.write_fmt(format_args!("Provided value is not a valid function: {value:?}")),
|
||||
Error::InvalidClass(value) =>
|
||||
f.write_fmt(format_args!("Provided value is not a valid class: {:?}", value)),
|
||||
f.write_fmt(format_args!("Provided value is not a valid class: {value:?}")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -51,15 +51,13 @@ impl Display for Error {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
Error::ValueIsNotAnObject { object } => f.write_fmt(format_args!(
|
||||
"JsValue was expected to be of type `object`, but was not: {:?}",
|
||||
object
|
||||
"JsValue was expected to be of type `object`, but was not: {object:?}"
|
||||
)),
|
||||
Error::PropertyNotFoundOnObject { object, property } => f.write_fmt(format_args!(
|
||||
"Object was expected to have property {:?} but has not: {:?}",
|
||||
property, object
|
||||
"Object was expected to have property {property:?} but has not: {object:?}"
|
||||
)),
|
||||
Error::ConstructorError { js_error } =>
|
||||
f.write_fmt(format_args!("Error while constructing object: {:?}", js_error)),
|
||||
f.write_fmt(format_args!("Error while constructing object: {js_error:?}")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ mod tests {
|
||||
fn run(&self) {
|
||||
let occupied = self.occupied.iter().cloned();
|
||||
let result = find_free_place(self.starting_point, self.direction, occupied).unwrap();
|
||||
assert_eq!(result, self.expected_result, "Case {:?} gave wrong result.", self);
|
||||
assert_eq!(result, self.expected_result, "Case {self:?} gave wrong result.");
|
||||
}
|
||||
|
||||
fn flip(&self, on_x: bool, on_y: bool) -> Self {
|
||||
|
@ -83,7 +83,7 @@ impl Model {
|
||||
|
||||
fn create_project_list_entry(project_name: &str) -> ClickableElement {
|
||||
let element = web::document.create_element_or_panic("li");
|
||||
element.set_inner_html(&format!(r#"<img src="assets/project.svg"/> {}"#, project_name));
|
||||
element.set_inner_html(&format!(r#"<img src="assets/project.svg"/> {project_name}"#));
|
||||
ClickableElement::new(element)
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,6 @@ pub trait OsStrExt {
|
||||
|
||||
impl OsStrExt for OsStr {
|
||||
fn as_str(&self) -> &str {
|
||||
self.to_str().unwrap_or_else(|| panic!("String is not valid UTF-8: {:?}", self))
|
||||
self.to_str().unwrap_or_else(|| panic!("String is not valid UTF-8: {self:?}"))
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ pub trait PathExt: AsRef<Path> {
|
||||
#[context("Failed to deserialize file `{}` as type `{}`.", self.as_ref().display(), std::any::type_name::<T>())]
|
||||
fn read_to_json<T: DeserializeOwned>(&self) -> Result<T> {
|
||||
let content = crate::fs::read_to_string(self)?;
|
||||
serde_json::from_str(&content).with_context(|| format!("File content was: {}", content))
|
||||
serde_json::from_str(&content).with_context(|| format!("File content was: {content}"))
|
||||
}
|
||||
|
||||
/// Write this file with a JSON-serialized value.
|
||||
|
@ -41,7 +41,7 @@ impl BucketContext {
|
||||
let path = path.as_ref();
|
||||
let normalized = path_slash::PathExt::to_slash_lossy(path);
|
||||
if let Some(prefix) = &self.key_prefix {
|
||||
format!("{}/{}", prefix, normalized)
|
||||
format!("{prefix}/{normalized}")
|
||||
} else {
|
||||
normalized.into()
|
||||
}
|
||||
|
@ -184,9 +184,7 @@ pub fn setup_customized_script_steps(
|
||||
steps.extend(customize(run(command_line)));
|
||||
steps.extend(list_everything_on_failure());
|
||||
steps.push(
|
||||
clean_step
|
||||
.with_if(format!("always() && {}", post_clean_condition))
|
||||
.with_name("Clean after"),
|
||||
clean_step.with_if(format!("always() && {post_clean_condition}")).with_name("Clean after"),
|
||||
);
|
||||
steps
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ impl BuildContext {
|
||||
};
|
||||
Result::Ok(release)
|
||||
}
|
||||
.with_context(move || format!("Failed to resolve release designator `{}`", designator_cp))
|
||||
.with_context(move || format!("Failed to resolve release designator `{designator_cp}`"))
|
||||
.boxed()
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ pub async fn download_project_templates(client: reqwest::Client, enso_root: Path
|
||||
let mut futures = Vec::<BoxFuture<'static, Result>>::new();
|
||||
for (project_name, relative_paths) in to_handle {
|
||||
for relative_path in relative_paths {
|
||||
let relative_url_base = url_base.join(&format!("{}/", project_name))?;
|
||||
let relative_url_base = url_base.join(&format!("{project_name}/"))?;
|
||||
let relative_output_base = output_base.join(project_name.to_lowercase());
|
||||
let client = client.clone();
|
||||
let future = async move {
|
||||
|
@ -58,7 +58,7 @@ pub fn pretty_print_arch(arch: Arch) -> &'static str {
|
||||
match arch {
|
||||
Arch::X86_64 => "amd64",
|
||||
Arch::AArch64 => "aarch64",
|
||||
_ => panic!("Unrecognized architecture {}", arch),
|
||||
_ => panic!("Unrecognized architecture {arch}"),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -182,7 +182,7 @@ pub trait IsTarget: Clone + Debug + Sized + Send + Sync + 'static {
|
||||
let artifact_fut = self.build_internal(context, job);
|
||||
let this = self.clone();
|
||||
async move {
|
||||
let artifact = artifact_fut.await.context(format!("Failed to build {:?}.", this))?;
|
||||
let artifact = artifact_fut.await.context(format!("Failed to build {this:?}."))?;
|
||||
// We upload only built artifacts. There would be no point in uploading something that
|
||||
// we've just downloaded. That's why the uploading code is here.
|
||||
if upload_artifacts {
|
||||
@ -255,8 +255,8 @@ pub trait IsTarget: Clone + Debug + Sized + Send + Sync + 'static {
|
||||
release.assets.iter().find(|asset| self.matches_asset(asset)).with_context(|| {
|
||||
let asset_names = release.assets.iter().map(|asset| &asset.name).join(", ");
|
||||
format!(
|
||||
"No matching asset for target {:?} in release {:?}. Available assets: {}",
|
||||
self, release, asset_names
|
||||
"No matching asset for target {self:?} in release {release:?}. \
|
||||
Available assets: {asset_names}"
|
||||
)
|
||||
})
|
||||
}
|
||||
|
@ -43,9 +43,9 @@ impl Artifact {
|
||||
}
|
||||
.into();
|
||||
let image = dist_dir.as_ref().join(match target_os {
|
||||
OS::Linux => format!("enso-linux-{}.AppImage", version),
|
||||
OS::MacOS => format!("enso-mac-{}.dmg", version),
|
||||
OS::Windows => format!("enso-win-{}.exe", version),
|
||||
OS::Linux => format!("enso-linux-{version}.AppImage"),
|
||||
OS::MacOS => format!("enso-mac-{version}.dmg"),
|
||||
OS::Windows => format!("enso-win-{version}.exe"),
|
||||
_ => todo!("{target_os}-{target_arch} combination is not supported"),
|
||||
});
|
||||
|
||||
@ -59,10 +59,10 @@ impl Artifact {
|
||||
|
||||
pub async fn upload_as_ci_artifact(&self) -> Result {
|
||||
if is_in_env() {
|
||||
upload_compressed_directory(&self.unpacked, format!("ide-unpacked-{}", TARGET_OS))
|
||||
upload_compressed_directory(&self.unpacked, format!("ide-unpacked-{TARGET_OS}"))
|
||||
.await?;
|
||||
upload_single_file(&self.image, format!("ide-{}", TARGET_OS)).await?;
|
||||
upload_single_file(&self.image_checksum, format!("ide-{}", TARGET_OS)).await?;
|
||||
upload_single_file(&self.image, format!("ide-{TARGET_OS}")).await?;
|
||||
upload_single_file(&self.image_checksum, format!("ide-{TARGET_OS}")).await?;
|
||||
} else {
|
||||
info!("Not in the CI environment, will not upload the artifacts.")
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ pub fn has_wasm_tests(member: &Path) -> bool {
|
||||
// We go over selected subdirectories only to avoid entering into sources of other crates
|
||||
// that are nested within this crate subtree.
|
||||
for subdir in SOURCE_SUBDIRECTORIES {
|
||||
let pattern = format!("{}/{}/**/*.rs", member, subdir);
|
||||
let pattern = format!("{member}/{subdir}/**/*.rs");
|
||||
for entry in glob::glob(&pattern).unwrap() {
|
||||
let contents = ide_ci::fs::read_to_string(entry.unwrap()).unwrap();
|
||||
if contents.lines().any(is_wasm_test_attribute) {
|
||||
@ -169,7 +169,7 @@ pub async fn test_all(repo_root: PathBuf, browsers: &[Browser]) -> Result {
|
||||
.run_ok()
|
||||
.await?;
|
||||
} else {
|
||||
println!("No wasm tests in {}", member_str);
|
||||
println!("No wasm tests in {member_str}");
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
|
@ -233,7 +233,7 @@ pub fn same_core_version(a: &Version, b: &Version) -> bool {
|
||||
}
|
||||
|
||||
pub fn generate_rc_prerelease(index: u32) -> Result<Prerelease> {
|
||||
Prerelease::from_str(&format!("{}.{}", RC_BUILD_PREFIX, index))
|
||||
Prerelease::from_str(&format!("{RC_BUILD_PREFIX}.{index}"))
|
||||
}
|
||||
|
||||
#[instrument(ret)]
|
||||
|
@ -61,7 +61,7 @@ impl TryFrom<&Prerelease> for NightlyPrerelease {
|
||||
let index =
|
||||
identifiers.get(4).map(|index| index.parse2()).transpose().context("Invalid index")?;
|
||||
let date = chrono::NaiveDate::from_ymd_opt(year, month, day)
|
||||
.with_context(|| format!("Invalid date: {}-{}-{}", year, month, day))?;
|
||||
.with_context(|| format!("Invalid date: {year}-{month}-{day}"))?;
|
||||
Ok(Self::new(date, index))
|
||||
}
|
||||
}
|
||||
@ -78,7 +78,7 @@ impl Display for NightlyPrerelease {
|
||||
date.day()
|
||||
)?;
|
||||
if let Some(index) = index {
|
||||
write!(f, ".{}", index)?;
|
||||
write!(f, ".{index}")?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
@ -228,7 +228,7 @@ pub async fn check_response(
|
||||
.map_err(|e| anyhow!("Also failed to obtain the response body: {}", e))?;
|
||||
|
||||
if let Ok(body_text) = std::str::from_utf8(body.as_ref()) {
|
||||
err = err.context(format!("Error response body was: {}", body_text));
|
||||
err = err.context(format!("Error response body was: {body_text}"));
|
||||
}
|
||||
|
||||
let err = additional_context(status, err);
|
||||
|
@ -955,7 +955,7 @@ pub fn checkout_repo_step_customized(f: impl FnOnce(Step) -> Step) -> Vec<Step>
|
||||
let submodules_workaround_win = Step {
|
||||
// We can't add git-bash to PATH because this would break the Rust build.
|
||||
// Instead we manually spawn the bash with a given command from CMD shell.
|
||||
run: Some(format!(r#""c:\Program Files\Git\bin\bash.exe" -c "{}""#, git_bash_command)),
|
||||
run: Some(format!(r#""c:\Program Files\Git\bin\bash.exe" -c "{git_bash_command}""#)),
|
||||
shell: Some(Shell::Cmd),
|
||||
r#if: Some(is_windows_runner()),
|
||||
name: Some(
|
||||
|
@ -106,7 +106,7 @@ pub fn digest<S: Storable>(storable: &S) -> Result<String> {
|
||||
|
||||
let mut digest = sha2::Sha224::default();
|
||||
sha2::Digest::update(&mut digest, [VERSION]);
|
||||
sha2::Digest::update(&mut digest, &key_serialized);
|
||||
sha2::Digest::update(&mut digest, key_serialized);
|
||||
std::any::TypeId::of::<S::Key>().hash(&mut HashToDigest(&mut digest));
|
||||
std::any::TypeId::of::<S>().hash(&mut HashToDigest(&mut digest));
|
||||
let digest = digest.finalize();
|
||||
@ -159,7 +159,7 @@ impl Cache {
|
||||
trace!("Value cannot be retrieved from cache because: {e}");
|
||||
crate::fs::reset_dir(&entry_dir)?;
|
||||
let key = storable.key();
|
||||
tracing::Span::current().record("key", &tracing::field::debug(&key));
|
||||
tracing::Span::current().record("key", tracing::field::debug(&key));
|
||||
let metadata = storable
|
||||
.generate(this, entry_dir.clone())
|
||||
.instrument(info_span!("Generating value to fill the cache."))
|
||||
|
2
build/ci_utils/src/cache/goodie/graalvm.rs
vendored
2
build/ci_utils/src/cache/goodie/graalvm.rs
vendored
@ -113,7 +113,7 @@ impl GraalVM {
|
||||
other_arch => unimplemented!("Architecture `{}` is not supported!", other_arch),
|
||||
};
|
||||
let java_version = format!("java{}", java_version.0);
|
||||
format!("{}-{}-{}-{}", PACKAGE_PREFIX, java_version, os_name, arch_name)
|
||||
format!("{PACKAGE_PREFIX}-{java_version}-{os_name}-{arch_name}")
|
||||
}
|
||||
|
||||
pub fn root_directory_name(&self) -> PathBuf {
|
||||
|
2
build/ci_utils/src/env/accessor.rs
vendored
2
build/ci_utils/src/env/accessor.rs
vendored
@ -119,7 +119,7 @@ impl TypedVariable for PathBufVariable {
|
||||
fn generate(&self, value: &Self::Borrowed) -> Result<String> {
|
||||
value
|
||||
.to_str()
|
||||
.with_context(|| format!("Path is not a valid string: {:?}.", value))
|
||||
.with_context(|| format!("Path is not a valid string: {value:?}."))
|
||||
.map(ToString::to_string)
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ pub trait CommandExt {
|
||||
fn describe(&self) -> String {
|
||||
let mut ret = String::new();
|
||||
let pretty_printed = format!("{:?}", self.as_std());
|
||||
let _ = write!(ret, "Command:\n\t{}", pretty_printed);
|
||||
let _ = write!(ret, "Command:\n\t{pretty_printed}");
|
||||
if let Some(cwd) = self.as_std().get_current_dir() {
|
||||
let _ = write!(ret, "\n\twith working directory: {}", cwd.display());
|
||||
};
|
||||
|
@ -172,7 +172,7 @@ pub async fn latest_runner_url(octocrab: &Octocrab, os: OS) -> Result<Url> {
|
||||
other_arch => unimplemented!("Architecture `{}` is not yet supported!", other_arch),
|
||||
};
|
||||
|
||||
let platform_name = format!("{}-{}", os_name, arch_name);
|
||||
let platform_name = format!("{os_name}-{arch_name}");
|
||||
find_asset_url_by_text(&latest_release, &platform_name).cloned()
|
||||
}
|
||||
|
||||
|
@ -197,7 +197,7 @@ mod tests {
|
||||
dbg!(&release);
|
||||
|
||||
let mut header_map = HeaderMap::new();
|
||||
header_map.append(reqwest::header::AUTHORIZATION, format!("Bearer {}", pat).parse()?);
|
||||
header_map.append(reqwest::header::AUTHORIZATION, format!("Bearer {pat}").parse()?);
|
||||
let client = reqwest::Client::builder()
|
||||
.user_agent("enso-build")
|
||||
.default_headers(header_map)
|
||||
|
@ -27,7 +27,7 @@ use reqwest::Response;
|
||||
///
|
||||
/// See also [`RepoRef`] for a non-owning equivalent.
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize, derive_more::Display)]
|
||||
#[display(fmt = "{}/{}", owner, name)]
|
||||
#[display(fmt = "{owner}/{name}")]
|
||||
pub struct Repo {
|
||||
/// Owner - an organization's or user's name.
|
||||
pub owner: String,
|
||||
@ -78,7 +78,7 @@ impl Repo {
|
||||
///
|
||||
/// Particularly useful for defining `const` repositories.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Deserialize, Serialize, derive_more::Display)]
|
||||
#[display(fmt = "{}/{}", owner, name)]
|
||||
#[display(fmt = "{owner}/{name}")]
|
||||
pub struct RepoRef<'a> {
|
||||
/// Owner - an organization's or user's name.
|
||||
pub owner: &'a str,
|
||||
@ -399,8 +399,7 @@ impl<R: IsRepo> Handle<R> {
|
||||
pub async fn default_branch(&self) -> Result<String> {
|
||||
self.get().await?.default_branch.with_context(|| {
|
||||
format!(
|
||||
"Failed to get the default branch of the {} repository. Missing field: `default_branch`.",
|
||||
self
|
||||
"Failed to get the default branch of the {self} repository. Missing field: `default_branch`.",
|
||||
)
|
||||
})
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ use std::time::Duration;
|
||||
|
||||
pub async fn get(client: &Client, url: impl IntoUrl) -> Result<Response> {
|
||||
let url = url.into_url()?;
|
||||
web::execute(client.get(url.clone())).await.with_context(|| format!("Failed to get {}", url))
|
||||
web::execute(client.get(url.clone())).await.with_context(|| format!("Failed to get {url}"))
|
||||
}
|
||||
|
||||
/// Get the the response body as a byte stream.
|
||||
@ -31,9 +31,9 @@ pub async fn download_all(client: &Client, url: impl IntoUrl) -> Result<Bytes> {
|
||||
let url = url.into_url()?;
|
||||
let bar = progress_bar(indicatif::ProgressBar::new_spinner);
|
||||
bar.enable_steady_tick(Duration::from_millis(100));
|
||||
bar.set_message(format!("Downloading {}", url));
|
||||
bar.set_message(format!("Downloading {url}"));
|
||||
let response = web::execute(client.get(url.clone())).await?;
|
||||
response.bytes().await.with_context(|| format!("Failed to download body of {}", url))
|
||||
response.bytes().await.with_context(|| format!("Failed to download body of {url}"))
|
||||
}
|
||||
|
||||
/// Downloads archive from URL and extracts it into an output path.
|
||||
|
@ -124,7 +124,7 @@ impl<'a> Generator<'a> {
|
||||
.iter()
|
||||
.find(|node| node.matches_ref(r#type))
|
||||
.copied()
|
||||
.context(format!("Could not find node for type reference: {}", r#type))
|
||||
.context(format!("Could not find node for type reference: {type}"))
|
||||
}
|
||||
|
||||
pub fn generate(&mut self) -> Result<TokenStream> {
|
||||
|
@ -345,7 +345,7 @@ impl Command {
|
||||
tracing::Span::current().record("status", exit_status.code());
|
||||
})
|
||||
.await?;
|
||||
status_checker(status).context(format!("Command failed: {}", pretty))
|
||||
status_checker(status).context(format!("Command failed: {pretty}"))
|
||||
}
|
||||
.instrument(span.exit())
|
||||
.boxed()
|
||||
@ -379,7 +379,7 @@ impl Command {
|
||||
})?;
|
||||
Result::Ok(output)
|
||||
}
|
||||
.map_err(move |e| e.context(format!("Failed to get output of the command: {}", pretty)))
|
||||
.map_err(move |e| e.context(format!("Failed to get output of the command: {pretty}")))
|
||||
.instrument(span.exit())
|
||||
.boxed()
|
||||
}
|
||||
@ -400,13 +400,13 @@ impl Command {
|
||||
|
||||
let current_span = tracing::Span::current();
|
||||
if current_span.field("command").is_some() {
|
||||
tracing::Span::current().record("command", &field::display(&pretty));
|
||||
tracing::Span::current().record("command", field::display(&pretty));
|
||||
debug!("Spawning.");
|
||||
} else {
|
||||
debug!("Spawning {}.", pretty);
|
||||
}
|
||||
|
||||
self.inner.spawn().context(format!("Failed to spawn: {}", pretty)).inspect(|child| {
|
||||
self.inner.spawn().context(format!("Failed to spawn: {pretty}")).inspect(|child| {
|
||||
if let Some(pid) = child.id() {
|
||||
current_span.record("pid", pid);
|
||||
}
|
||||
|
@ -52,14 +52,14 @@ impl Shell for Cmd {
|
||||
fn modify_env(&self, change: &Modification) -> Result<String> {
|
||||
let name = &change.variable_name;
|
||||
Ok(match &change.action {
|
||||
Action::Remove => format!("set {}=", name),
|
||||
Action::Set(value) => format!("set {}={}", name, value),
|
||||
Action::Remove => format!("set {name}="),
|
||||
Action::Set(value) => format!("set {name}={value}"),
|
||||
Action::PrependPaths(paths) => self.set_prepended_paths(name, paths)?,
|
||||
})
|
||||
}
|
||||
|
||||
fn access_environment_variable(&self, name: &str) -> String {
|
||||
format!("%{}%", name)
|
||||
format!("%{name}%")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -353,7 +353,7 @@ impl RestartPolicy {
|
||||
let value = match self {
|
||||
RestartPolicy::No => "no".into(),
|
||||
RestartPolicy::OnFailure { max_retries: Some(max_retries) } =>
|
||||
format!("on-failure:{}", max_retries).into(),
|
||||
format!("on-failure:{max_retries}").into(),
|
||||
RestartPolicy::OnFailure { max_retries: None } => "on-failure:{}".into(),
|
||||
RestartPolicy::Always => "always".into(),
|
||||
RestartPolicy::UnlessStopped => "unless-stopped".into(),
|
||||
@ -381,8 +381,8 @@ impl Display for Network {
|
||||
match self {
|
||||
Network::Bridge => write!(f, "bridge"),
|
||||
Network::Host => write!(f, "host"),
|
||||
Network::User(name) => write!(f, "{}", name),
|
||||
Network::Container(name_or_id) => write!(f, "container:{}", name_or_id),
|
||||
Network::User(name) => write!(f, "{name}"),
|
||||
Network::Container(name_or_id) => write!(f, "container:{name_or_id}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -501,7 +501,7 @@ impl RunOptions {
|
||||
if let Some(storage_size_gb) = self.storage_size_gb {
|
||||
// e.g. --storage-opt size=120G
|
||||
ret.push("--storage-opt".into());
|
||||
ret.push(format!("size={}G", storage_size_gb).into());
|
||||
ret.push(format!("size={storage_size_gb}G").into());
|
||||
}
|
||||
|
||||
if let Some(sig_proxy) = self.sig_proxy {
|
||||
|
@ -383,7 +383,7 @@ mod tests {
|
||||
async fn repo_root() -> Result {
|
||||
let git = Context::new(".").await?;
|
||||
let diff = git.repository_root().await?;
|
||||
println!("{:?}", diff);
|
||||
println!("{diff:?}");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@ -392,7 +392,7 @@ mod tests {
|
||||
async fn call_diff() -> Result {
|
||||
let git = Context::new(".").await?;
|
||||
let diff = git.diff_against("origin/develop").await?;
|
||||
println!("{:?}", diff);
|
||||
println!("{diff:?}");
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
@ -167,7 +167,7 @@ impl Display for Placeholder {
|
||||
match self {
|
||||
Placeholder::Newline => write!(f, "%n"),
|
||||
Placeholder::Percent => write!(f, "%%"),
|
||||
Placeholder::HexCode(code) => write!(f, "%{:02x}", code),
|
||||
Placeholder::HexCode(code) => write!(f, "%{code:02x}"),
|
||||
Placeholder::Hash => write!(f, "%H"),
|
||||
Placeholder::AbbreviatedHash => write!(f, "%h"),
|
||||
Placeholder::TreeHash => write!(f, "%T"),
|
||||
|
@ -48,16 +48,16 @@ impl Shell for PwSh {
|
||||
fn modify_env(&self, change: &Modification) -> Result<String> {
|
||||
let name = &change.variable_name;
|
||||
Ok(match &change.action {
|
||||
Action::Remove => format!(r"Remove-Item Env:\{}", name),
|
||||
Action::Remove => format!(r"Remove-Item Env:\{name}"),
|
||||
Action::Set(value) => {
|
||||
format!(r#"$env:{} = "{}""#, name, value)
|
||||
format!(r#"$env:{name} = "{value}""#)
|
||||
}
|
||||
Action::PrependPaths(paths) => self.set_prepended_paths(name, paths)?,
|
||||
})
|
||||
}
|
||||
|
||||
fn access_environment_variable(&self, name: &str) -> String {
|
||||
format!(r"$env:{}", name)
|
||||
format!(r"$env:{name}")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,16 +43,16 @@ impl Shell for Bash {
|
||||
fn modify_env(&self, change: &Modification) -> Result<String> {
|
||||
let name = &change.variable_name;
|
||||
Ok(match &change.action {
|
||||
Action::Remove => format!("unset {}", name),
|
||||
Action::Remove => format!("unset {name}"),
|
||||
Action::Set(value) => {
|
||||
format!("export {}={}", name, value)
|
||||
format!("export {name}={value}")
|
||||
}
|
||||
Action::PrependPaths(paths) => self.set_prepended_paths(name, paths)?,
|
||||
})
|
||||
}
|
||||
|
||||
fn access_environment_variable(&self, name: &str) -> String {
|
||||
format!("${}", name)
|
||||
format!("${name}")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ impl VsWhere {
|
||||
let stdout = command.run_stdout().await?;
|
||||
let instances = serde_json::from_str::<Vec<InstanceInfo>>(&stdout)?;
|
||||
instances.into_iter().next().with_context(|| {
|
||||
format!("No Visual Studio installation found with component {}.", component)
|
||||
format!("No Visual Studio installation found with component {component}.")
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ fn get_all_crates() -> Vec<PathBuf> {
|
||||
let valid_paths = all_paths.filter_map(|path| match path {
|
||||
Ok(path) => Some(path.parent().unwrap().to_owned()),
|
||||
Err(err) => {
|
||||
println!("cargo:warning={}", err);
|
||||
println!("cargo:warning={err}");
|
||||
None
|
||||
}
|
||||
});
|
||||
@ -44,7 +44,7 @@ fn has_wasm_tests(member: &Path) -> bool {
|
||||
// We go over selected subdirectories only to avoid entering into sources of other crates
|
||||
// that are nested within this crate subtree.
|
||||
for subdir in SOURCE_SUBDIRECTORIES {
|
||||
let pattern = format!("{}/{}/**/*.rs", member, subdir);
|
||||
let pattern = format!("{member}/{subdir}/**/*.rs");
|
||||
for entry in glob::glob(&pattern).unwrap() {
|
||||
let contents = std::fs::read_to_string(entry.unwrap()).unwrap();
|
||||
if contents.lines().any(is_wasm_test_attribute) {
|
||||
@ -97,23 +97,23 @@ fn main() {
|
||||
for member in all_members {
|
||||
let member_str = member.to_string_lossy();
|
||||
if blacklisted(&member) {
|
||||
println!("Skipping blacklisted crate {}", member_str);
|
||||
println!("Skipping blacklisted crate {member_str}");
|
||||
} else if is_proc_macro_crate(&member) {
|
||||
println!("Skipping proc-macro crate {}", member_str);
|
||||
println!("Skipping proc-macro crate {member_str}");
|
||||
} else if has_wasm_tests(&member) {
|
||||
println!("Running tests for {}", member_str);
|
||||
println!("Running tests for {member_str}");
|
||||
let mut command = std::process::Command::new("wasm-pack");
|
||||
command.arg("test").args(&wasm_pack_args).arg(&member);
|
||||
println!("{:?}", command);
|
||||
println!("{command:?}");
|
||||
let status = command.status().unwrap();
|
||||
if !status.success() {
|
||||
panic!("Process for {} failed!{}", member_str, match status.code() {
|
||||
Some(code) => format!(" Code: {}", code),
|
||||
Some(code) => format!(" Code: {code}"),
|
||||
None => String::new(),
|
||||
});
|
||||
}
|
||||
} else {
|
||||
println!("No wasm tests in {}", member_str);
|
||||
println!("No wasm tests in {member_str}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ impl HeaderElement {
|
||||
/// Regex constructor that starts on the beginning of a line, can be surrounded by whitespaces and
|
||||
/// ends with a line break.
|
||||
fn header_line_regex(input: &str) -> Regex {
|
||||
let str = format!(r"^ *{} *(; *)?((\r\n?)|\n)", input);
|
||||
let str = format!(r"^ *{input} *(; *)?((\r\n?)|\n)");
|
||||
Regex::new(&str).unwrap()
|
||||
}
|
||||
|
||||
@ -274,7 +274,7 @@ fn print_h1(
|
||||
if tokens.iter().any(|tok| map.contains_key(tok)) {
|
||||
writeln!(out).unwrap();
|
||||
writeln!(out, "// ===={}====", "=".repeat(str.len())).unwrap();
|
||||
writeln!(out, "// === {} ===", str).unwrap();
|
||||
writeln!(out, "// === {str} ===").unwrap();
|
||||
writeln!(out, "// ===={}====", "=".repeat(str.len())).unwrap();
|
||||
writeln!(out).unwrap();
|
||||
}
|
||||
@ -290,7 +290,7 @@ fn print_h2(
|
||||
use std::fmt::Write;
|
||||
|
||||
if tokens.iter().map(|tok| map.contains_key(tok)).any(|t| t) {
|
||||
writeln!(out, "// === {} ===", str).unwrap()
|
||||
writeln!(out, "// === {str} ===").unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
@ -440,7 +440,7 @@ pub async fn process_file(
|
||||
let (hash, input) = read_file_with_hash(path).await?;
|
||||
let out = process_file_content(input, is_main_file)?;
|
||||
if action == Action::DryRun {
|
||||
println!("{}", out)
|
||||
println!("{out}")
|
||||
} else if action == Action::Format || action == Action::FormatAndCheck {
|
||||
fs::write(path, out).await?;
|
||||
}
|
||||
@ -542,7 +542,7 @@ pub fn process_file_content(input: String, is_main_file: bool) -> Result<String>
|
||||
map.remove(&ModuleAttribWarn);
|
||||
}
|
||||
|
||||
let std_linter_attribs = STD_LINTER_ATTRIBS.iter().map(|t| format!("#![{}]\n", t));
|
||||
let std_linter_attribs = STD_LINTER_ATTRIBS.iter().map(|t| format!("#![{t}]\n"));
|
||||
map.entry(StandardLinterConfig).or_default().extend(std_linter_attribs);
|
||||
}
|
||||
|
||||
|
@ -57,13 +57,11 @@ async fn debug_mode() {
|
||||
let message = expect_popup_message.expect();
|
||||
assert!(
|
||||
message.contains("Debug Mode enabled"),
|
||||
"Message \"{}\" does not mention enabling Debug mode",
|
||||
message
|
||||
"Message \"{message}\" does not mention enabling Debug mode"
|
||||
);
|
||||
assert!(
|
||||
message.contains(enso_gui::view::debug_mode_popup::DEBUG_MODE_SHORTCUT),
|
||||
"Message \"{}\" does not inform about shortcut to turn mode off",
|
||||
message
|
||||
"Message \"{message}\" does not inform about shortcut to turn mode off"
|
||||
);
|
||||
assert!(graph_editor.debug_mode.value());
|
||||
|
||||
@ -75,8 +73,7 @@ async fn debug_mode() {
|
||||
let message = expect_popup_message.expect();
|
||||
assert!(
|
||||
message.contains("Debug Mode disabled"),
|
||||
"Message \"{}\" does not mention disabling of debug mode",
|
||||
message
|
||||
"Message \"{message}\" does not mention disabling of debug mode"
|
||||
);
|
||||
assert!(!graph_editor.debug_mode.value());
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ impl Dfa {
|
||||
|
||||
let mut out = String::new();
|
||||
for row in 0..self.links.rows {
|
||||
writeln!(out, "node_{}[label=\"{}\"]", row, row)?;
|
||||
writeln!(out, "node_{row}[label=\"{row}\"]")?;
|
||||
for column in 0..self.links.columns {
|
||||
let state = self.links[(row, column)];
|
||||
if !state.is_invalid() {
|
||||
@ -85,7 +85,7 @@ impl Dfa {
|
||||
}
|
||||
let opts = "node [shape=circle style=filled fillcolor=\"#4385f5\" fontcolor=\"#FFFFFF\" \
|
||||
color=white penwidth=5.0 margin=0.1 width=0.5 height=0.5 fixedsize=true]";
|
||||
Ok(format!("digraph G {{\n{}\n{}\n}}\n", opts, out))
|
||||
Ok(format!("digraph G {{\n{opts}\n{out}\n}}\n"))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -249,7 +249,7 @@ impl Nfa {
|
||||
for (ix, state) in self.states.iter().enumerate() {
|
||||
let opts =
|
||||
if state.export { "" } else { "[fillcolor=\"#EEEEEE\" fontcolor=\"#888888\"]" };
|
||||
writeln!(out, "node_{}[label=\"{}\"]{}", ix, ix, opts)?;
|
||||
writeln!(out, "node_{ix}[label=\"{ix}\"]{opts}")?;
|
||||
for link in &state.links {
|
||||
writeln!(
|
||||
out,
|
||||
@ -265,7 +265,7 @@ impl Nfa {
|
||||
}
|
||||
let opts = "node [shape=circle style=filled fillcolor=\"#4385f5\" fontcolor=\"#FFFFFF\" \
|
||||
color=white penwidth=5.0 margin=0.1 width=0.5 height=0.5 fixedsize=true]";
|
||||
Ok(format!("digraph G {{\n{}\n{}\n}}\n", opts, out))
|
||||
Ok(format!("digraph G {{\n{opts}\n{out}\n}}\n"))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ impl<T> Default for State<T> {
|
||||
impl<T> Debug for State<T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
let name = if *self == Self::INVALID { "INVALID".into() } else { format!("{:?}", self.id) };
|
||||
write!(f, "State({})", name)
|
||||
write!(f, "State({name})")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -126,7 +126,7 @@ impl From<u32> for Symbol {
|
||||
|
||||
impl From<char> for Symbol {
|
||||
fn from(ch: char) -> Symbol {
|
||||
Symbol::new_named(ch as u64, format!("{}", ch))
|
||||
Symbol::new_named(ch as u64, format!("{ch}"))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,12 +96,11 @@ pub fn generate_config_module_from_yaml(config_path: impl AsRef<std::path::Path>
|
||||
for (key, value) in mapping {
|
||||
let key = key.as_str().unwrap().to_snake_case();
|
||||
let value = value.as_str().unwrap();
|
||||
writeln!(def, "{}pub {}: &'static str,", indent, key).unwrap();
|
||||
writeln!(inst, "{}{}: \"{}\",", indent, key, value).unwrap();
|
||||
writeln!(def, "{indent}pub {key}: &'static str,").unwrap();
|
||||
writeln!(inst, "{indent}{key}: \"{value}\",").unwrap();
|
||||
writeln!(
|
||||
vars,
|
||||
"#[allow(non_upper_case_globals)]\npub const {}: &str = \"{}\";",
|
||||
key, value
|
||||
"#[allow(non_upper_case_globals)]\npub const {key}: &str = \"{value}\";"
|
||||
)
|
||||
.unwrap();
|
||||
},
|
||||
|
@ -517,7 +517,7 @@ mod tests {
|
||||
tree.set(path.clone(), *val)
|
||||
}
|
||||
let new_tree: HashMapTree<_, _, RandomState> =
|
||||
tree.iter().map(|(p, v)| (p, format!("{}", v))).collect();
|
||||
tree.iter().map(|(p, v)| (p, format!("{v}"))).collect();
|
||||
for (val, path) in values.iter().zip(&paths) {
|
||||
let path = path.clone();
|
||||
let output = new_tree.get(path.iter()).unwrap().clone();
|
||||
|
@ -165,14 +165,14 @@ impl<T, I: Index> OptVec<T, I> {
|
||||
impl<T, I: Index> std::ops::Index<I> for OptVec<T, I> {
|
||||
type Output = T;
|
||||
fn index(&self, index: I) -> &Self::Output {
|
||||
let error = || panic!("Trying to access removed index `{:?}`.", index);
|
||||
let error = || panic!("Trying to access removed index `{index:?}`.");
|
||||
self.items.index(index.into()).as_ref().unwrap_or_else(error)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T, I: Index> std::ops::IndexMut<I> for OptVec<T, I> {
|
||||
fn index_mut(&mut self, index: I) -> &mut Self::Output {
|
||||
let error = || panic!("Trying to access removed index `{:?}`.", index);
|
||||
let error = || panic!("Trying to access removed index `{index:?}`.");
|
||||
self.items.index_mut(index.into()).as_mut().unwrap_or_else(error)
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ mod huge_text_generator {
|
||||
let offset = hash_from(line_index) % 32;
|
||||
let prefix = (0..offset).map(|_| '|').collect::<String>();
|
||||
writeln!(file).unwrap();
|
||||
write!(file, "{}", prefix).unwrap();
|
||||
write!(file, "{prefix}").unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ mod background {
|
||||
let radius = &height / 2.0;
|
||||
let base_shape = Rect((&width,&height)).corners_radius(radius);
|
||||
let shape = base_shape.fill(Var::<color::Rgba>::from(bg_color.clone()));
|
||||
let alpha = Var::<f32>::from(format!("({0}.w)",bg_color));
|
||||
let alpha = Var::<f32>::from(format!("({bg_color}.w)"));
|
||||
let shadow = shadow::from_shape_with_alpha(base_shape.into(),&alpha,style);
|
||||
|
||||
(shadow+shape).into()
|
||||
|
@ -276,7 +276,7 @@ mod tests {
|
||||
fn test_value_in_bounds() {
|
||||
let test = |start, end, value, expected| {
|
||||
let result = value_in_bounds(value, Bounds::new(start, end));
|
||||
assert_eq!(result, expected, "Testing whether {} in ]{},{}[", value, start, end)
|
||||
assert_eq!(result, expected, "Testing whether {value} in ]{start},{end}[")
|
||||
};
|
||||
|
||||
test(0.0, 1.0, 0.0, true);
|
||||
@ -303,11 +303,7 @@ mod tests {
|
||||
fn test_bounds_in_bounds() {
|
||||
let test = |start1, end1, start2, end2, expected| {
|
||||
let result = bounds_in_bounds(Bounds::new(start1, start2), Bounds::new(start2, end2));
|
||||
assert_eq!(
|
||||
result, expected,
|
||||
"Testing whether ]{},{}[ in ]{},{}[",
|
||||
start1, end1, start2, end2
|
||||
);
|
||||
assert_eq!(result, expected, "Testing whether ]{start1},{end1}[ in ]{start2},{end2}[");
|
||||
};
|
||||
|
||||
test(0.0, 1.0, 0.0, 1.0, true);
|
||||
|
@ -72,7 +72,7 @@ impl Frp {
|
||||
let network = &frp.network;
|
||||
|
||||
frp::extend! { network
|
||||
formatted <- frp.set_content.map(|value| format!("{:.2}", value).to_im_string());
|
||||
formatted <- frp.set_content.map(|value| format!("{value:.2}").to_im_string());
|
||||
// FIXME: the next line is locale dependent as it is meant to split on the decimal
|
||||
// separator, which might be different from "." in some locales. We need a way to get
|
||||
// the current locale dependent decimal separator for this.
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user