app: update to rust 1.63 and fix some lint issues

Fix format! and missing derive
This commit is contained in:
Stéphane Cerveau 2022-09-06 12:38:22 +02:00
parent 25859ec1cd
commit ebbc1d2261
4 changed files with 23 additions and 23 deletions

View file

@ -2,6 +2,7 @@
name = "gst_pipeline_studio"
version = "0.2.3"
edition = "2018"
rust-version = "1.63"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View file

@ -14,6 +14,7 @@ use crate::GPS_INFO;
use gst::glib;
use gst::prelude::*;
use std::collections::HashMap;
use std::fmt::Write as _;
#[derive(Debug, Default, Eq, Ord, PartialEq, PartialOrd)]
pub struct ElementInfo {
@ -65,7 +66,7 @@ impl ElementInfo {
if let Ok(factory) = feature.downcast::<gst::ElementFactory>() {
desc.push_str("<b>Factory details:</b>\n");
desc.push_str("<b>Rank:</b>");
desc.push_str(&format!("{:?}", rank));
let _ = write!(desc, "{:?}", rank);
desc.push('\n');
desc.push_str("<b>Name:</b>");
desc.push_str(&factory.name());
@ -78,7 +79,7 @@ impl ElementInfo {
desc.push_str("<b>");
desc.push_str(&key);
desc.push_str("</b>:");
desc.push_str(&gtk::glib::markup_escape_text(val).to_string());
desc.push_str(&gtk::glib::markup_escape_text(val));
desc.push('\n');
}
}
@ -94,25 +95,22 @@ impl ElementInfo {
desc.push('\n');
desc.push_str("<b>Description:");
desc.push_str("</b>");
desc.push_str(&gtk::glib::markup_escape_text(&plugin.description()).to_string());
desc.push_str(&gtk::glib::markup_escape_text(&plugin.description()));
desc.push('\n');
desc.push_str("<b>Filename:");
desc.push_str("</b>");
desc.push_str(
&gtk::glib::markup_escape_text(
&plugin
.filename()
.unwrap_or_default()
.as_path()
.display()
.to_string(),
)
.to_string(),
);
desc.push_str(&gtk::glib::markup_escape_text(
&plugin
.filename()
.unwrap_or_default()
.as_path()
.display()
.to_string(),
));
desc.push('\n');
desc.push_str("<b>Version:");
desc.push_str("</b>");
desc.push_str(&gtk::glib::markup_escape_text(&plugin.version()).to_string());
desc.push_str(&gtk::glib::markup_escape_text(&plugin.version()));
desc.push('\n');
}
}
@ -215,7 +213,7 @@ impl ElementInfo {
pub fn search_fo_element(bin: &gst::Bin, element_name: &str) -> Vec<gst::Element> {
let mut iter = bin.iterate_elements();
let mut elements: Vec<gst::Element> = Vec::new();
let elements = loop {
elements = loop {
match iter.next() {
Ok(Some(element)) => {
if element.is::<gst::Bin>() {

View file

@ -13,7 +13,7 @@ use crate::graphmanager::{PortDirection, PortPresence};
use gst::prelude::*;
#[derive(Debug, PartialOrd, PartialEq)]
#[derive(Debug, PartialOrd, PartialEq, Eq)]
pub struct PadInfo {
name: Option<String>,
element_name: Option<String>,

View file

@ -20,10 +20,11 @@ use gtk::gdk;
use std::cell::{Cell, RefCell};
use std::collections::HashMap;
use std::fmt;
use std::fmt::Write as _;
use std::ops;
use std::rc::{Rc, Weak};
#[derive(Debug, Clone, Copy, PartialEq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum PipelineState {
Playing,
Paused,
@ -332,13 +333,13 @@ impl Player {
mut description: String,
) -> String {
let unique_name = node.unique_name();
description.push_str(&format!("{} name={} ", node.name(), unique_name));
let _ = write!(description, "{} name={} ", node.name(), unique_name);
elements.insert(unique_name.clone(), unique_name.clone());
// Node properties
for (name, value) in node.properties().iter() {
//This allow to have an index in front of a property such as an enum.
if !node.hidden_property(name) {
description.push_str(&format!("{}={} ", name, value));
let _ = write!(description, "{}={} ", name, value);
}
}
//Port properties
@ -346,7 +347,7 @@ impl Player {
for port in ports {
for (name, value) in port.properties().iter() {
if !port.hidden_property(name) {
description.push_str(&format!("{}::{}={} ", port.name(), name, value));
let _ = write!(description, "{}::{}={} ", port.name(), name, value);
}
}
}
@ -356,13 +357,13 @@ impl Player {
for port in ports {
if let Some((_port_to, node_to)) = graphview.port_connected_to(port.id()) {
if n_ports > 1 {
description.push_str(&format!("{}. ! ", unique_name));
let _ = write!(description, "{}. ! ", unique_name);
} else {
description.push_str("! ");
}
if let Some(node) = graphview.node(node_to) {
if elements.contains_key(&node.unique_name()) {
description.push_str(&format!("{}. ", node.unique_name()));
let _ = write!(description, "{}. ", node.unique_name());
} else {
description =
self.process_gst_node(graphview, &node, elements, description.clone());